AWS v6.54.0 published on Friday, Sep 27, 2024 by Pulumi
aws.cognito.UserInGroup
Explore with Pulumi AI
Adds the specified user to the specified group.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.cognito.UserPool("example", {
name: "example",
passwordPolicy: {
temporaryPasswordValidityDays: 7,
minimumLength: 6,
requireUppercase: false,
requireSymbols: false,
requireNumbers: false,
},
});
const exampleUser = new aws.cognito.User("example", {
userPoolId: example.id,
username: "example",
});
const exampleUserGroup = new aws.cognito.UserGroup("example", {
userPoolId: example.id,
name: "example",
});
const exampleUserInGroup = new aws.cognito.UserInGroup("example", {
userPoolId: example.id,
groupName: exampleUserGroup.name,
username: exampleUser.username,
});
import pulumi
import pulumi_aws as aws
example = aws.cognito.UserPool("example",
name="example",
password_policy={
"temporary_password_validity_days": 7,
"minimum_length": 6,
"require_uppercase": False,
"require_symbols": False,
"require_numbers": False,
})
example_user = aws.cognito.User("example",
user_pool_id=example.id,
username="example")
example_user_group = aws.cognito.UserGroup("example",
user_pool_id=example.id,
name="example")
example_user_in_group = aws.cognito.UserInGroup("example",
user_pool_id=example.id,
group_name=example_user_group.name,
username=example_user.username)
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cognito"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := cognito.NewUserPool(ctx, "example", &cognito.UserPoolArgs{
Name: pulumi.String("example"),
PasswordPolicy: &cognito.UserPoolPasswordPolicyArgs{
TemporaryPasswordValidityDays: pulumi.Int(7),
MinimumLength: pulumi.Int(6),
RequireUppercase: pulumi.Bool(false),
RequireSymbols: pulumi.Bool(false),
RequireNumbers: pulumi.Bool(false),
},
})
if err != nil {
return err
}
exampleUser, err := cognito.NewUser(ctx, "example", &cognito.UserArgs{
UserPoolId: example.ID(),
Username: pulumi.String("example"),
})
if err != nil {
return err
}
exampleUserGroup, err := cognito.NewUserGroup(ctx, "example", &cognito.UserGroupArgs{
UserPoolId: example.ID(),
Name: pulumi.String("example"),
})
if err != nil {
return err
}
_, err = cognito.NewUserInGroup(ctx, "example", &cognito.UserInGroupArgs{
UserPoolId: example.ID(),
GroupName: exampleUserGroup.Name,
Username: exampleUser.Username,
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Cognito.UserPool("example", new()
{
Name = "example",
PasswordPolicy = new Aws.Cognito.Inputs.UserPoolPasswordPolicyArgs
{
TemporaryPasswordValidityDays = 7,
MinimumLength = 6,
RequireUppercase = false,
RequireSymbols = false,
RequireNumbers = false,
},
});
var exampleUser = new Aws.Cognito.User("example", new()
{
UserPoolId = example.Id,
Username = "example",
});
var exampleUserGroup = new Aws.Cognito.UserGroup("example", new()
{
UserPoolId = example.Id,
Name = "example",
});
var exampleUserInGroup = new Aws.Cognito.UserInGroup("example", new()
{
UserPoolId = example.Id,
GroupName = exampleUserGroup.Name,
Username = exampleUser.Username,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cognito.UserPool;
import com.pulumi.aws.cognito.UserPoolArgs;
import com.pulumi.aws.cognito.inputs.UserPoolPasswordPolicyArgs;
import com.pulumi.aws.cognito.User;
import com.pulumi.aws.cognito.UserArgs;
import com.pulumi.aws.cognito.UserGroup;
import com.pulumi.aws.cognito.UserGroupArgs;
import com.pulumi.aws.cognito.UserInGroup;
import com.pulumi.aws.cognito.UserInGroupArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new UserPool("example", UserPoolArgs.builder()
.name("example")
.passwordPolicy(UserPoolPasswordPolicyArgs.builder()
.temporaryPasswordValidityDays(7)
.minimumLength(6)
.requireUppercase(false)
.requireSymbols(false)
.requireNumbers(false)
.build())
.build());
var exampleUser = new User("exampleUser", UserArgs.builder()
.userPoolId(example.id())
.username("example")
.build());
var exampleUserGroup = new UserGroup("exampleUserGroup", UserGroupArgs.builder()
.userPoolId(example.id())
.name("example")
.build());
var exampleUserInGroup = new UserInGroup("exampleUserInGroup", UserInGroupArgs.builder()
.userPoolId(example.id())
.groupName(exampleUserGroup.name())
.username(exampleUser.username())
.build());
}
}
resources:
example:
type: aws:cognito:UserPool
properties:
name: example
passwordPolicy:
temporaryPasswordValidityDays: 7
minimumLength: 6
requireUppercase: false
requireSymbols: false
requireNumbers: false
exampleUser:
type: aws:cognito:User
name: example
properties:
userPoolId: ${example.id}
username: example
exampleUserGroup:
type: aws:cognito:UserGroup
name: example
properties:
userPoolId: ${example.id}
name: example
exampleUserInGroup:
type: aws:cognito:UserInGroup
name: example
properties:
userPoolId: ${example.id}
groupName: ${exampleUserGroup.name}
username: ${exampleUser.username}
Create UserInGroup Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new UserInGroup(name: string, args: UserInGroupArgs, opts?: CustomResourceOptions);
@overload
def UserInGroup(resource_name: str,
args: UserInGroupArgs,
opts: Optional[ResourceOptions] = None)
@overload
def UserInGroup(resource_name: str,
opts: Optional[ResourceOptions] = None,
group_name: Optional[str] = None,
user_pool_id: Optional[str] = None,
username: Optional[str] = None)
func NewUserInGroup(ctx *Context, name string, args UserInGroupArgs, opts ...ResourceOption) (*UserInGroup, error)
public UserInGroup(string name, UserInGroupArgs args, CustomResourceOptions? opts = null)
public UserInGroup(String name, UserInGroupArgs args)
public UserInGroup(String name, UserInGroupArgs args, CustomResourceOptions options)
type: aws:cognito:UserInGroup
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args UserInGroupArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args UserInGroupArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args UserInGroupArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args UserInGroupArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args UserInGroupArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var userInGroupResource = new Aws.Cognito.UserInGroup("userInGroupResource", new()
{
GroupName = "string",
UserPoolId = "string",
Username = "string",
});
example, err := cognito.NewUserInGroup(ctx, "userInGroupResource", &cognito.UserInGroupArgs{
GroupName: pulumi.String("string"),
UserPoolId: pulumi.String("string"),
Username: pulumi.String("string"),
})
var userInGroupResource = new UserInGroup("userInGroupResource", UserInGroupArgs.builder()
.groupName("string")
.userPoolId("string")
.username("string")
.build());
user_in_group_resource = aws.cognito.UserInGroup("userInGroupResource",
group_name="string",
user_pool_id="string",
username="string")
const userInGroupResource = new aws.cognito.UserInGroup("userInGroupResource", {
groupName: "string",
userPoolId: "string",
username: "string",
});
type: aws:cognito:UserInGroup
properties:
groupName: string
userPoolId: string
username: string
UserInGroup Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The UserInGroup resource accepts the following input properties:
- Group
Name string - The name of the group to which the user is to be added.
- User
Pool stringId - The user pool ID of the user and group.
- Username string
- The username of the user to be added to the group.
- Group
Name string - The name of the group to which the user is to be added.
- User
Pool stringId - The user pool ID of the user and group.
- Username string
- The username of the user to be added to the group.
- group
Name String - The name of the group to which the user is to be added.
- user
Pool StringId - The user pool ID of the user and group.
- username String
- The username of the user to be added to the group.
- group
Name string - The name of the group to which the user is to be added.
- user
Pool stringId - The user pool ID of the user and group.
- username string
- The username of the user to be added to the group.
- group_
name str - The name of the group to which the user is to be added.
- user_
pool_ strid - The user pool ID of the user and group.
- username str
- The username of the user to be added to the group.
- group
Name String - The name of the group to which the user is to be added.
- user
Pool StringId - The user pool ID of the user and group.
- username String
- The username of the user to be added to the group.
Outputs
All input properties are implicitly available as output properties. Additionally, the UserInGroup resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing UserInGroup Resource
Get an existing UserInGroup resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: UserInGroupState, opts?: CustomResourceOptions): UserInGroup
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
group_name: Optional[str] = None,
user_pool_id: Optional[str] = None,
username: Optional[str] = None) -> UserInGroup
func GetUserInGroup(ctx *Context, name string, id IDInput, state *UserInGroupState, opts ...ResourceOption) (*UserInGroup, error)
public static UserInGroup Get(string name, Input<string> id, UserInGroupState? state, CustomResourceOptions? opts = null)
public static UserInGroup get(String name, Output<String> id, UserInGroupState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Group
Name string - The name of the group to which the user is to be added.
- User
Pool stringId - The user pool ID of the user and group.
- Username string
- The username of the user to be added to the group.
- Group
Name string - The name of the group to which the user is to be added.
- User
Pool stringId - The user pool ID of the user and group.
- Username string
- The username of the user to be added to the group.
- group
Name String - The name of the group to which the user is to be added.
- user
Pool StringId - The user pool ID of the user and group.
- username String
- The username of the user to be added to the group.
- group
Name string - The name of the group to which the user is to be added.
- user
Pool stringId - The user pool ID of the user and group.
- username string
- The username of the user to be added to the group.
- group_
name str - The name of the group to which the user is to be added.
- user_
pool_ strid - The user pool ID of the user and group.
- username str
- The username of the user to be added to the group.
- group
Name String - The name of the group to which the user is to be added.
- user
Pool StringId - The user pool ID of the user and group.
- username String
- The username of the user to be added to the group.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
aws
Terraform Provider.