1. Packages
  2. AWS Classic
  3. API Docs
  4. cognito
  5. UserInGroup

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.13.1 published on Tuesday, Dec 5, 2023 by Pulumi

aws.cognito.UserInGroup

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.13.1 published on Tuesday, Dec 5, 2023 by Pulumi

    Adds the specified user to the specified group.

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleUserPool = new Aws.Cognito.UserPool("exampleUserPool", new()
        {
            PasswordPolicy = new Aws.Cognito.Inputs.UserPoolPasswordPolicyArgs
            {
                TemporaryPasswordValidityDays = 7,
                MinimumLength = 6,
                RequireUppercase = false,
                RequireSymbols = false,
                RequireNumbers = false,
            },
        });
    
        var exampleUser = new Aws.Cognito.User("exampleUser", new()
        {
            UserPoolId = exampleUserPool.Id,
            Username = "example",
        });
    
        var exampleUserGroup = new Aws.Cognito.UserGroup("exampleUserGroup", new()
        {
            UserPoolId = exampleUserPool.Id,
        });
    
        var exampleUserInGroup = new Aws.Cognito.UserInGroup("exampleUserInGroup", new()
        {
            UserPoolId = exampleUserPool.Id,
            GroupName = exampleUserGroup.Name,
            Username = exampleUser.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 {
    		exampleUserPool, err := cognito.NewUserPool(ctx, "exampleUserPool", &cognito.UserPoolArgs{
    			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, "exampleUser", &cognito.UserArgs{
    			UserPoolId: exampleUserPool.ID(),
    			Username:   pulumi.String("example"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleUserGroup, err := cognito.NewUserGroup(ctx, "exampleUserGroup", &cognito.UserGroupArgs{
    			UserPoolId: exampleUserPool.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = cognito.NewUserInGroup(ctx, "exampleUserInGroup", &cognito.UserInGroupArgs{
    			UserPoolId: exampleUserPool.ID(),
    			GroupName:  exampleUserGroup.Name,
    			Username:   exampleUser.Username,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    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 exampleUserPool = new UserPool("exampleUserPool", UserPoolArgs.builder()        
                .passwordPolicy(UserPoolPasswordPolicyArgs.builder()
                    .temporaryPasswordValidityDays(7)
                    .minimumLength(6)
                    .requireUppercase(false)
                    .requireSymbols(false)
                    .requireNumbers(false)
                    .build())
                .build());
    
            var exampleUser = new User("exampleUser", UserArgs.builder()        
                .userPoolId(exampleUserPool.id())
                .username("example")
                .build());
    
            var exampleUserGroup = new UserGroup("exampleUserGroup", UserGroupArgs.builder()        
                .userPoolId(exampleUserPool.id())
                .build());
    
            var exampleUserInGroup = new UserInGroup("exampleUserInGroup", UserInGroupArgs.builder()        
                .userPoolId(exampleUserPool.id())
                .groupName(exampleUserGroup.name())
                .username(exampleUser.username())
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_aws as aws
    
    example_user_pool = aws.cognito.UserPool("exampleUserPool", password_policy=aws.cognito.UserPoolPasswordPolicyArgs(
        temporary_password_validity_days=7,
        minimum_length=6,
        require_uppercase=False,
        require_symbols=False,
        require_numbers=False,
    ))
    example_user = aws.cognito.User("exampleUser",
        user_pool_id=example_user_pool.id,
        username="example")
    example_user_group = aws.cognito.UserGroup("exampleUserGroup", user_pool_id=example_user_pool.id)
    example_user_in_group = aws.cognito.UserInGroup("exampleUserInGroup",
        user_pool_id=example_user_pool.id,
        group_name=example_user_group.name,
        username=example_user.username)
    
    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const exampleUserPool = new aws.cognito.UserPool("exampleUserPool", {passwordPolicy: {
        temporaryPasswordValidityDays: 7,
        minimumLength: 6,
        requireUppercase: false,
        requireSymbols: false,
        requireNumbers: false,
    }});
    const exampleUser = new aws.cognito.User("exampleUser", {
        userPoolId: exampleUserPool.id,
        username: "example",
    });
    const exampleUserGroup = new aws.cognito.UserGroup("exampleUserGroup", {userPoolId: exampleUserPool.id});
    const exampleUserInGroup = new aws.cognito.UserInGroup("exampleUserInGroup", {
        userPoolId: exampleUserPool.id,
        groupName: exampleUserGroup.name,
        username: exampleUser.username,
    });
    
    resources:
      exampleUserPool:
        type: aws:cognito:UserPool
        properties:
          passwordPolicy:
            temporaryPasswordValidityDays: 7
            minimumLength: 6
            requireUppercase: false
            requireSymbols: false
            requireNumbers: false
      exampleUser:
        type: aws:cognito:User
        properties:
          userPoolId: ${exampleUserPool.id}
          username: example
      exampleUserGroup:
        type: aws:cognito:UserGroup
        properties:
          userPoolId: ${exampleUserPool.id}
      exampleUserInGroup:
        type: aws:cognito:UserInGroup
        properties:
          userPoolId: ${exampleUserPool.id}
          groupName: ${exampleUserGroup.name}
          username: ${exampleUser.username}
    

    Create UserInGroup Resource

    new UserInGroup(name: string, args: UserInGroupArgs, opts?: CustomResourceOptions);
    @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)
    @overload
    def UserInGroup(resource_name: str,
                    args: UserInGroupArgs,
                    opts: Optional[ResourceOptions] = 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.
    
    
    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.

    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:

    GroupName string

    The name of the group to which the user is to be added.

    UserPoolId string

    The user pool ID of the user and group.

    Username string

    The username of the user to be added to the group.

    GroupName string

    The name of the group to which the user is to be added.

    UserPoolId string

    The user pool ID of the user and group.

    Username string

    The username of the user to be added to the group.

    groupName String

    The name of the group to which the user is to be added.

    userPoolId String

    The user pool ID of the user and group.

    username String

    The username of the user to be added to the group.

    groupName string

    The name of the group to which the user is to be added.

    userPoolId string

    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_id str

    The user pool ID of the user and group.

    username str

    The username of the user to be added to the group.

    groupName String

    The name of the group to which the user is to be added.

    userPoolId String

    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.
    The following state arguments are supported:
    GroupName string

    The name of the group to which the user is to be added.

    UserPoolId string

    The user pool ID of the user and group.

    Username string

    The username of the user to be added to the group.

    GroupName string

    The name of the group to which the user is to be added.

    UserPoolId string

    The user pool ID of the user and group.

    Username string

    The username of the user to be added to the group.

    groupName String

    The name of the group to which the user is to be added.

    userPoolId String

    The user pool ID of the user and group.

    username String

    The username of the user to be added to the group.

    groupName string

    The name of the group to which the user is to be added.

    userPoolId string

    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_id str

    The user pool ID of the user and group.

    username str

    The username of the user to be added to the group.

    groupName String

    The name of the group to which the user is to be added.

    userPoolId String

    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.

    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.13.1 published on Tuesday, Dec 5, 2023 by Pulumi