1. Packages
  2. AWS Classic
  3. API Docs
  4. elasticache
  5. UserGroupAssociation

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

AWS Classic v6.32.0 published on Friday, Apr 19, 2024 by Pulumi

aws.elasticache.UserGroupAssociation

Explore with Pulumi AI

aws logo

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

AWS Classic v6.32.0 published on Friday, Apr 19, 2024 by Pulumi

    Associate an existing ElastiCache user and an existing user group.

    NOTE: The provider will detect changes in the aws.elasticache.UserGroup since aws.elasticache.UserGroupAssociation changes the user IDs associated with the user group. You can ignore these changes with the ignore_changes option as shown in the example.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const _default = new aws.elasticache.User("default", {
        userId: "defaultUserID",
        userName: "default",
        accessString: "on ~app::* -@all +@read +@hash +@bitmap +@geo -setbit -bitfield -hset -hsetnx -hmset -hincrby -hincrbyfloat -hdel -bitop -geoadd -georadius -georadiusbymember",
        engine: "REDIS",
        passwords: ["password123456789"],
    });
    const example = new aws.elasticache.UserGroup("example", {
        engine: "REDIS",
        userGroupId: "userGroupId",
        userIds: [_default.userId],
    });
    const exampleUser = new aws.elasticache.User("example", {
        userId: "exampleUserID",
        userName: "exampleuser",
        accessString: "on ~app::* -@all +@read +@hash +@bitmap +@geo -setbit -bitfield -hset -hsetnx -hmset -hincrby -hincrbyfloat -hdel -bitop -geoadd -georadius -georadiusbymember",
        engine: "REDIS",
        passwords: ["password123456789"],
    });
    const exampleUserGroupAssociation = new aws.elasticache.UserGroupAssociation("example", {
        userGroupId: example.userGroupId,
        userId: exampleUser.userId,
    });
    
    import pulumi
    import pulumi_aws as aws
    
    default = aws.elasticache.User("default",
        user_id="defaultUserID",
        user_name="default",
        access_string="on ~app::* -@all +@read +@hash +@bitmap +@geo -setbit -bitfield -hset -hsetnx -hmset -hincrby -hincrbyfloat -hdel -bitop -geoadd -georadius -georadiusbymember",
        engine="REDIS",
        passwords=["password123456789"])
    example = aws.elasticache.UserGroup("example",
        engine="REDIS",
        user_group_id="userGroupId",
        user_ids=[default.user_id])
    example_user = aws.elasticache.User("example",
        user_id="exampleUserID",
        user_name="exampleuser",
        access_string="on ~app::* -@all +@read +@hash +@bitmap +@geo -setbit -bitfield -hset -hsetnx -hmset -hincrby -hincrbyfloat -hdel -bitop -geoadd -georadius -georadiusbymember",
        engine="REDIS",
        passwords=["password123456789"])
    example_user_group_association = aws.elasticache.UserGroupAssociation("example",
        user_group_id=example.user_group_id,
        user_id=example_user.user_id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/elasticache"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := elasticache.NewUser(ctx, "default", &elasticache.UserArgs{
    			UserId:       pulumi.String("defaultUserID"),
    			UserName:     pulumi.String("default"),
    			AccessString: pulumi.String("on ~app::* -@all +@read +@hash +@bitmap +@geo -setbit -bitfield -hset -hsetnx -hmset -hincrby -hincrbyfloat -hdel -bitop -geoadd -georadius -georadiusbymember"),
    			Engine:       pulumi.String("REDIS"),
    			Passwords: pulumi.StringArray{
    				pulumi.String("password123456789"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		example, err := elasticache.NewUserGroup(ctx, "example", &elasticache.UserGroupArgs{
    			Engine:      pulumi.String("REDIS"),
    			UserGroupId: pulumi.String("userGroupId"),
    			UserIds: pulumi.StringArray{
    				_default.UserId,
    			},
    		})
    		if err != nil {
    			return err
    		}
    		exampleUser, err := elasticache.NewUser(ctx, "example", &elasticache.UserArgs{
    			UserId:       pulumi.String("exampleUserID"),
    			UserName:     pulumi.String("exampleuser"),
    			AccessString: pulumi.String("on ~app::* -@all +@read +@hash +@bitmap +@geo -setbit -bitfield -hset -hsetnx -hmset -hincrby -hincrbyfloat -hdel -bitop -geoadd -georadius -georadiusbymember"),
    			Engine:       pulumi.String("REDIS"),
    			Passwords: pulumi.StringArray{
    				pulumi.String("password123456789"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = elasticache.NewUserGroupAssociation(ctx, "example", &elasticache.UserGroupAssociationArgs{
    			UserGroupId: example.UserGroupId,
    			UserId:      exampleUser.UserId,
    		})
    		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 @default = new Aws.ElastiCache.User("default", new()
        {
            UserId = "defaultUserID",
            UserName = "default",
            AccessString = "on ~app::* -@all +@read +@hash +@bitmap +@geo -setbit -bitfield -hset -hsetnx -hmset -hincrby -hincrbyfloat -hdel -bitop -geoadd -georadius -georadiusbymember",
            Engine = "REDIS",
            Passwords = new[]
            {
                "password123456789",
            },
        });
    
        var example = new Aws.ElastiCache.UserGroup("example", new()
        {
            Engine = "REDIS",
            UserGroupId = "userGroupId",
            UserIds = new[]
            {
                @default.UserId,
            },
        });
    
        var exampleUser = new Aws.ElastiCache.User("example", new()
        {
            UserId = "exampleUserID",
            UserName = "exampleuser",
            AccessString = "on ~app::* -@all +@read +@hash +@bitmap +@geo -setbit -bitfield -hset -hsetnx -hmset -hincrby -hincrbyfloat -hdel -bitop -geoadd -georadius -georadiusbymember",
            Engine = "REDIS",
            Passwords = new[]
            {
                "password123456789",
            },
        });
    
        var exampleUserGroupAssociation = new Aws.ElastiCache.UserGroupAssociation("example", new()
        {
            UserGroupId = example.UserGroupId,
            UserId = exampleUser.UserId,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.elasticache.User;
    import com.pulumi.aws.elasticache.UserArgs;
    import com.pulumi.aws.elasticache.UserGroup;
    import com.pulumi.aws.elasticache.UserGroupArgs;
    import com.pulumi.aws.elasticache.UserGroupAssociation;
    import com.pulumi.aws.elasticache.UserGroupAssociationArgs;
    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 default_ = new User("default", UserArgs.builder()        
                .userId("defaultUserID")
                .userName("default")
                .accessString("on ~app::* -@all +@read +@hash +@bitmap +@geo -setbit -bitfield -hset -hsetnx -hmset -hincrby -hincrbyfloat -hdel -bitop -geoadd -georadius -georadiusbymember")
                .engine("REDIS")
                .passwords("password123456789")
                .build());
    
            var example = new UserGroup("example", UserGroupArgs.builder()        
                .engine("REDIS")
                .userGroupId("userGroupId")
                .userIds(default_.userId())
                .build());
    
            var exampleUser = new User("exampleUser", UserArgs.builder()        
                .userId("exampleUserID")
                .userName("exampleuser")
                .accessString("on ~app::* -@all +@read +@hash +@bitmap +@geo -setbit -bitfield -hset -hsetnx -hmset -hincrby -hincrbyfloat -hdel -bitop -geoadd -georadius -georadiusbymember")
                .engine("REDIS")
                .passwords("password123456789")
                .build());
    
            var exampleUserGroupAssociation = new UserGroupAssociation("exampleUserGroupAssociation", UserGroupAssociationArgs.builder()        
                .userGroupId(example.userGroupId())
                .userId(exampleUser.userId())
                .build());
    
        }
    }
    
    resources:
      default:
        type: aws:elasticache:User
        properties:
          userId: defaultUserID
          userName: default
          accessString: on ~app::* -@all +@read +@hash +@bitmap +@geo -setbit -bitfield -hset -hsetnx -hmset -hincrby -hincrbyfloat -hdel -bitop -geoadd -georadius -georadiusbymember
          engine: REDIS
          passwords:
            - password123456789
      example:
        type: aws:elasticache:UserGroup
        properties:
          engine: REDIS
          userGroupId: userGroupId
          userIds:
            - ${default.userId}
      exampleUser:
        type: aws:elasticache:User
        name: example
        properties:
          userId: exampleUserID
          userName: exampleuser
          accessString: on ~app::* -@all +@read +@hash +@bitmap +@geo -setbit -bitfield -hset -hsetnx -hmset -hincrby -hincrbyfloat -hdel -bitop -geoadd -georadius -georadiusbymember
          engine: REDIS
          passwords:
            - password123456789
      exampleUserGroupAssociation:
        type: aws:elasticache:UserGroupAssociation
        name: example
        properties:
          userGroupId: ${example.userGroupId}
          userId: ${exampleUser.userId}
    

    Create UserGroupAssociation Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new UserGroupAssociation(name: string, args: UserGroupAssociationArgs, opts?: CustomResourceOptions);
    @overload
    def UserGroupAssociation(resource_name: str,
                             args: UserGroupAssociationArgs,
                             opts: Optional[ResourceOptions] = None)
    
    @overload
    def UserGroupAssociation(resource_name: str,
                             opts: Optional[ResourceOptions] = None,
                             user_group_id: Optional[str] = None,
                             user_id: Optional[str] = None)
    func NewUserGroupAssociation(ctx *Context, name string, args UserGroupAssociationArgs, opts ...ResourceOption) (*UserGroupAssociation, error)
    public UserGroupAssociation(string name, UserGroupAssociationArgs args, CustomResourceOptions? opts = null)
    public UserGroupAssociation(String name, UserGroupAssociationArgs args)
    public UserGroupAssociation(String name, UserGroupAssociationArgs args, CustomResourceOptions options)
    
    type: aws:elasticache:UserGroupAssociation
    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 UserGroupAssociationArgs
    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 UserGroupAssociationArgs
    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 UserGroupAssociationArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args UserGroupAssociationArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args UserGroupAssociationArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var userGroupAssociationResource = new Aws.ElastiCache.UserGroupAssociation("userGroupAssociationResource", new()
    {
        UserGroupId = "string",
        UserId = "string",
    });
    
    example, err := elasticache.NewUserGroupAssociation(ctx, "userGroupAssociationResource", &elasticache.UserGroupAssociationArgs{
    	UserGroupId: pulumi.String("string"),
    	UserId:      pulumi.String("string"),
    })
    
    var userGroupAssociationResource = new UserGroupAssociation("userGroupAssociationResource", UserGroupAssociationArgs.builder()        
        .userGroupId("string")
        .userId("string")
        .build());
    
    user_group_association_resource = aws.elasticache.UserGroupAssociation("userGroupAssociationResource",
        user_group_id="string",
        user_id="string")
    
    const userGroupAssociationResource = new aws.elasticache.UserGroupAssociation("userGroupAssociationResource", {
        userGroupId: "string",
        userId: "string",
    });
    
    type: aws:elasticache:UserGroupAssociation
    properties:
        userGroupId: string
        userId: string
    

    UserGroupAssociation 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 UserGroupAssociation resource accepts the following input properties:

    UserGroupId string
    ID of the user group.
    UserId string
    ID of the user to associated with the user group.
    UserGroupId string
    ID of the user group.
    UserId string
    ID of the user to associated with the user group.
    userGroupId String
    ID of the user group.
    userId String
    ID of the user to associated with the user group.
    userGroupId string
    ID of the user group.
    userId string
    ID of the user to associated with the user group.
    user_group_id str
    ID of the user group.
    user_id str
    ID of the user to associated with the user group.
    userGroupId String
    ID of the user group.
    userId String
    ID of the user to associated with the user group.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the UserGroupAssociation 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 UserGroupAssociation Resource

    Get an existing UserGroupAssociation 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?: UserGroupAssociationState, opts?: CustomResourceOptions): UserGroupAssociation
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            user_group_id: Optional[str] = None,
            user_id: Optional[str] = None) -> UserGroupAssociation
    func GetUserGroupAssociation(ctx *Context, name string, id IDInput, state *UserGroupAssociationState, opts ...ResourceOption) (*UserGroupAssociation, error)
    public static UserGroupAssociation Get(string name, Input<string> id, UserGroupAssociationState? state, CustomResourceOptions? opts = null)
    public static UserGroupAssociation get(String name, Output<String> id, UserGroupAssociationState 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:
    UserGroupId string
    ID of the user group.
    UserId string
    ID of the user to associated with the user group.
    UserGroupId string
    ID of the user group.
    UserId string
    ID of the user to associated with the user group.
    userGroupId String
    ID of the user group.
    userId String
    ID of the user to associated with the user group.
    userGroupId string
    ID of the user group.
    userId string
    ID of the user to associated with the user group.
    user_group_id str
    ID of the user group.
    user_id str
    ID of the user to associated with the user group.
    userGroupId String
    ID of the user group.
    userId String
    ID of the user to associated with the user group.

    Import

    Using pulumi import, import ElastiCache user group associations using the user_group_id and user_id. For example:

    $ pulumi import aws:elasticache/userGroupAssociation:UserGroupAssociation example userGoupId1,userId
    

    To learn more about importing existing cloud resources, see Importing resources.

    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.32.0 published on Friday, Apr 19, 2024 by Pulumi