aws logo
AWS Classic v5.29.0, Feb 1 23

aws.elasticache.UserGroupAssociation

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

using System.Collections.Generic;
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 exampleUserGroup = new Aws.ElastiCache.UserGroup("exampleUserGroup", new()
    {
        Engine = "REDIS",
        UserGroupId = "userGroupId",
        UserIds = new[]
        {
            @default.UserId,
        },
    });

    var exampleUser = new Aws.ElastiCache.User("exampleUser", 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("exampleUserGroupAssociation", new()
    {
        UserGroupId = exampleUserGroup.UserGroupId,
        UserId = exampleUser.UserId,
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/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
		}
		exampleUserGroup, err := elasticache.NewUserGroup(ctx, "exampleUserGroup", &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, "exampleUser", &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, "exampleUserGroupAssociation", &elasticache.UserGroupAssociationArgs{
			UserGroupId: exampleUserGroup.UserGroupId,
			UserId:      exampleUser.UserId,
		})
		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.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 exampleUserGroup = new UserGroup("exampleUserGroup", 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(exampleUserGroup.userGroupId())
            .userId(exampleUser.userId())
            .build());

    }
}
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_user_group = aws.elasticache.UserGroup("exampleUserGroup",
    engine="REDIS",
    user_group_id="userGroupId",
    user_ids=[default.user_id])
example_user = aws.elasticache.User("exampleUser",
    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("exampleUserGroupAssociation",
    user_group_id=example_user_group.user_group_id,
    user_id=example_user.user_id)
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 exampleUserGroup = new aws.elasticache.UserGroup("exampleUserGroup", {
    engine: "REDIS",
    userGroupId: "userGroupId",
    userIds: [_default.userId],
});
const exampleUser = new aws.elasticache.User("exampleUser", {
    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("exampleUserGroupAssociation", {
    userGroupId: exampleUserGroup.userGroupId,
    userId: exampleUser.userId,
});
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
  exampleUserGroup:
    type: aws:elasticache:UserGroup
    properties:
      engine: REDIS
      userGroupId: userGroupId
      userIds:
        - ${default.userId}
  exampleUser:
    type: aws:elasticache:User
    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
    properties:
      userGroupId: ${exampleUserGroup.userGroupId}
      userId: ${exampleUser.userId}

Create UserGroupAssociation Resource

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

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.

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

ElastiCache user group associations can be imported using the user_group_id and user_id, e.g.,

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

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.