Skip to content

Resource: awsCognitoUserInGroup

Adds the specified user to the specified group.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsCognitoUserExample = new aws.cognitoUser.CognitoUser(this, "example", {
  userPoolId: "${aws_cognito_user_pool.test.id}",
  username: "example",
});
const awsCognitoUserGroupExample = new aws.cognitoUserGroup.CognitoUserGroup(
  this,
  "example_1",
  {
    name: "example",
    userPoolId: "${aws_cognito_user_pool.test.id}",
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsCognitoUserGroupExample.overrideLogicalId("example");
const awsCognitoUserPoolExample = new aws.cognitoUserPool.CognitoUserPool(
  this,
  "example_2",
  {
    name: "example",
    passwordPolicy: {
      minimumLength: 6,
      requireNumbers: false,
      requireSymbols: false,
      requireUppercase: false,
      temporaryPasswordValidityDays: 7,
    },
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsCognitoUserPoolExample.overrideLogicalId("example");
const awsCognitoUserInGroupExample =
  new aws.cognitoUserInGroup.CognitoUserInGroup(this, "example_3", {
    groupName: awsCognitoUserGroupExample.name,
    userPoolId: awsCognitoUserPoolExample.id,
    username: awsCognitoUserExample.username,
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsCognitoUserInGroupExample.overrideLogicalId("example");

Argument Reference

The following arguments are required:

  • userPoolId - (Required) The user pool ID of the user and group.
  • groupName - (Required) The name of the group to which the user is to be added.
  • username - (Required) The username of the user to be added to the group.

Attributes Reference

No additional attributes are exported.