UserGroup

Provides a Cognito User Group resource.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var mainUserPool = new Aws.Cognito.UserPool("mainUserPool", new Aws.Cognito.UserPoolArgs
        {
        });
        var groupRole = new Aws.Iam.Role("groupRole", new Aws.Iam.RoleArgs
        {
            AssumeRolePolicy = @"{
  ""Version"": ""2012-10-17"",
  ""Statement"": [
    {
      ""Sid"": """",
      ""Effect"": ""Allow"",
      ""Principal"": {
        ""Federated"": ""cognito-identity.amazonaws.com""
      },
      ""Action"": ""sts:AssumeRoleWithWebIdentity"",
      ""Condition"": {
        ""StringEquals"": {
          ""cognito-identity.amazonaws.com:aud"": ""us-east-1:12345678-dead-beef-cafe-123456790ab""
        },
        ""ForAnyValue:StringLike"": {
          ""cognito-identity.amazonaws.com:amr"": ""authenticated""
        }
      }
    }
  ]
}

",
        });
        var mainUserGroup = new Aws.Cognito.UserGroup("mainUserGroup", new Aws.Cognito.UserGroupArgs
        {
            Description = "Managed by Pulumi",
            Precedence = 42,
            RoleArn = groupRole.Arn,
            UserPoolId = mainUserPool.Id,
        });
    }

}
package main

import (
    "fmt"

    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws/cognito"
    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws/iam"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        mainUserPool, err := cognito.NewUserPool(ctx, "mainUserPool", nil)
        if err != nil {
            return err
        }
        groupRole, err := iam.NewRole(ctx, "groupRole", &iam.RoleArgs{
            AssumeRolePolicy: pulumi.String(fmt.Sprintf("%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v", "{\n", "  \"Version\": \"2012-10-17\",\n", "  \"Statement\": [\n", "    {\n", "      \"Sid\": \"\",\n", "      \"Effect\": \"Allow\",\n", "      \"Principal\": {\n", "        \"Federated\": \"cognito-identity.amazonaws.com\"\n", "      },\n", "      \"Action\": \"sts:AssumeRoleWithWebIdentity\",\n", "      \"Condition\": {\n", "        \"StringEquals\": {\n", "          \"cognito-identity.amazonaws.com:aud\": \"us-east-1:12345678-dead-beef-cafe-123456790ab\"\n", "        },\n", "        \"ForAnyValue:StringLike\": {\n", "          \"cognito-identity.amazonaws.com:amr\": \"authenticated\"\n", "        }\n", "      }\n", "    }\n", "  ]\n", "}\n", "\n")),
        })
        if err != nil {
            return err
        }
        _, err = cognito.NewUserGroup(ctx, "mainUserGroup", &cognito.UserGroupArgs{
            Description: pulumi.String("Managed by Pulumi"),
            Precedence:  pulumi.Int(42),
            RoleArn:     groupRole.Arn,
            UserPoolId:  mainUserPool.ID(),
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_aws as aws

main_user_pool = aws.cognito.UserPool("mainUserPool")
group_role = aws.iam.Role("groupRole", assume_role_policy="""{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "",
      "Effect": "Allow",
      "Principal": {
        "Federated": "cognito-identity.amazonaws.com"
      },
      "Action": "sts:AssumeRoleWithWebIdentity",
      "Condition": {
        "StringEquals": {
          "cognito-identity.amazonaws.com:aud": "us-east-1:12345678-dead-beef-cafe-123456790ab"
        },
        "ForAnyValue:StringLike": {
          "cognito-identity.amazonaws.com:amr": "authenticated"
        }
      }
    }
  ]
}

""")
main_user_group = aws.cognito.UserGroup("mainUserGroup",
    description="Managed by Pulumi",
    precedence=42,
    role_arn=group_role.arn,
    user_pool_id=main_user_pool.id)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const mainUserPool = new aws.cognito.UserPool("main", {});
const groupRole = new aws.iam.Role("group_role", {
    assumeRolePolicy: `{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "",
      "Effect": "Allow",
      "Principal": {
        "Federated": "cognito-identity.amazonaws.com"
      },
      "Action": "sts:AssumeRoleWithWebIdentity",
      "Condition": {
        "StringEquals": {
          "cognito-identity.amazonaws.com:aud": "us-east-1:12345678-dead-beef-cafe-123456790ab"
        },
        "ForAnyValue:StringLike": {
          "cognito-identity.amazonaws.com:amr": "authenticated"
        }
      }
    }
  ]
}
`,
});
const mainUserGroup = new aws.cognito.UserGroup("main", {
    description: "Managed by Pulumi",
    precedence: 42,
    roleArn: groupRole.arn,
    userPoolId: mainUserPool.id,
});

Create a UserGroup Resource

def UserGroup(resource_name, opts=None, description=None, name=None, precedence=None, role_arn=None, user_pool_id=None, __props__=None);
func NewUserGroup(ctx *Context, name string, args UserGroupArgs, opts ...ResourceOption) (*UserGroup, error)
public UserGroup(string name, UserGroupArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args UserGroupArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args UserGroupArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args UserGroupArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

UserGroup Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The UserGroup resource accepts the following input properties:

UserPoolId string

The user pool ID.

Description string

The description of the user group.

Name string

The name of the user group.

Precedence int

The precedence of the user group.

RoleArn string

The ARN of the IAM role to be associated with the user group.

UserPoolId string

The user pool ID.

Description string

The description of the user group.

Name string

The name of the user group.

Precedence int

The precedence of the user group.

RoleArn string

The ARN of the IAM role to be associated with the user group.

userPoolId string

The user pool ID.

description string

The description of the user group.

name string

The name of the user group.

precedence number

The precedence of the user group.

roleArn string

The ARN of the IAM role to be associated with the user group.

user_pool_id str

The user pool ID.

description str

The description of the user group.

name str

The name of the user group.

precedence float

The precedence of the user group.

role_arn str

The ARN of the IAM role to be associated with the user group.

Outputs

All input properties are implicitly available as output properties. Additionally, the UserGroup 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 str
The provider-assigned unique ID for this managed resource.

Look up an Existing UserGroup Resource

Get an existing UserGroup 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?: UserGroupState, opts?: CustomResourceOptions): UserGroup
static get(resource_name, id, opts=None, description=None, name=None, precedence=None, role_arn=None, user_pool_id=None, __props__=None);
func GetUserGroup(ctx *Context, name string, id IDInput, state *UserGroupState, opts ...ResourceOption) (*UserGroup, error)
public static UserGroup Get(string name, Input<string> id, UserGroupState? state, CustomResourceOptions? opts = null)
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.

The following state arguments are supported:

Description string

The description of the user group.

Name string

The name of the user group.

Precedence int

The precedence of the user group.

RoleArn string

The ARN of the IAM role to be associated with the user group.

UserPoolId string

The user pool ID.

Description string

The description of the user group.

Name string

The name of the user group.

Precedence int

The precedence of the user group.

RoleArn string

The ARN of the IAM role to be associated with the user group.

UserPoolId string

The user pool ID.

description string

The description of the user group.

name string

The name of the user group.

precedence number

The precedence of the user group.

roleArn string

The ARN of the IAM role to be associated with the user group.

userPoolId string

The user pool ID.

description str

The description of the user group.

name str

The name of the user group.

precedence float

The precedence of the user group.

role_arn str

The ARN of the IAM role to be associated with the user group.

user_pool_id str

The user pool ID.

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.