GroupMembership

WARNING: Multiple aws.iam.GroupMembership resources with the same group name will produce inconsistent behavior!

Provides a top level resource to manage IAM Group membership for IAM Users. For more information on managing IAM Groups or IAM Users, see IAM Groups or IAM Users

Note: aws.iam.GroupMembership will conflict with itself if used more than once with the same group. To non-exclusively manage the users in a group, see the aws.iam.UserGroupMembership resource.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var @group = new Aws.Iam.Group("group", new Aws.Iam.GroupArgs
        {
        });
        var userOne = new Aws.Iam.User("userOne", new Aws.Iam.UserArgs
        {
        });
        var userTwo = new Aws.Iam.User("userTwo", new Aws.Iam.UserArgs
        {
        });
        var team = new Aws.Iam.GroupMembership("team", new Aws.Iam.GroupMembershipArgs
        {
            Users = 
            {
                userOne.Name,
                userTwo.Name,
            },
            Group = @group.Name,
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v4/go/aws/iam"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		group, err := iam.NewGroup(ctx, "group", nil)
		if err != nil {
			return err
		}
		userOne, err := iam.NewUser(ctx, "userOne", nil)
		if err != nil {
			return err
		}
		userTwo, err := iam.NewUser(ctx, "userTwo", nil)
		if err != nil {
			return err
		}
		_, err = iam.NewGroupMembership(ctx, "team", &iam.GroupMembershipArgs{
			Users: pulumi.StringArray{
				userOne.Name,
				userTwo.Name,
			},
			Group: group.Name,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_aws as aws

group = aws.iam.Group("group")
user_one = aws.iam.User("userOne")
user_two = aws.iam.User("userTwo")
team = aws.iam.GroupMembership("team",
    users=[
        user_one.name,
        user_two.name,
    ],
    group=group.name)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const group = new aws.iam.Group("group", {});
const userOne = new aws.iam.User("userOne", {});
const userTwo = new aws.iam.User("userTwo", {});
const team = new aws.iam.GroupMembership("team", {
    users: [
        userOne.name,
        userTwo.name,
    ],
    group: group.name,
});

Create a GroupMembership Resource

new GroupMembership(name: string, args: GroupMembershipArgs, opts?: CustomResourceOptions);
@overload
def GroupMembership(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    group: Optional[str] = None,
                    name: Optional[str] = None,
                    users: Optional[Sequence[str]] = None)
@overload
def GroupMembership(resource_name: str,
                    args: GroupMembershipArgs,
                    opts: Optional[ResourceOptions] = None)
func NewGroupMembership(ctx *Context, name string, args GroupMembershipArgs, opts ...ResourceOption) (*GroupMembership, error)
public GroupMembership(string name, GroupMembershipArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args GroupMembershipArgs
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 GroupMembershipArgs
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 GroupMembershipArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args GroupMembershipArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

GroupMembership Resource Properties

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

Inputs

The GroupMembership resource accepts the following input properties:

Group string
The IAM Group name to attach the list of users to
Users List<string>
A list of IAM User names to associate with the Group
Name string
The name to identify the Group Membership
Group string
The IAM Group name to attach the list of users to
Users []string
A list of IAM User names to associate with the Group
Name string
The name to identify the Group Membership
group string
The IAM Group name to attach the list of users to
users string[]
A list of IAM User names to associate with the Group
name string
The name to identify the Group Membership
group str
The IAM Group name to attach the list of users to
users Sequence[str]
A list of IAM User names to associate with the Group
name str
The name to identify the Group Membership

Outputs

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

Get an existing GroupMembership 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?: GroupMembershipState, opts?: CustomResourceOptions): GroupMembership
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        group: Optional[str] = None,
        name: Optional[str] = None,
        users: Optional[Sequence[str]] = None) -> GroupMembership
func GetGroupMembership(ctx *Context, name string, id IDInput, state *GroupMembershipState, opts ...ResourceOption) (*GroupMembership, error)
public static GroupMembership Get(string name, Input<string> id, GroupMembershipState? 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:

Group string
The IAM Group name to attach the list of users to
Name string
The name to identify the Group Membership
Users List<string>
A list of IAM User names to associate with the Group
Group string
The IAM Group name to attach the list of users to
Name string
The name to identify the Group Membership
Users []string
A list of IAM User names to associate with the Group
group string
The IAM Group name to attach the list of users to
name string
The name to identify the Group Membership
users string[]
A list of IAM User names to associate with the Group
group str
The IAM Group name to attach the list of users to
name str
The name to identify the Group Membership
users Sequence[str]
A list of IAM User names to associate with the Group

Package Details

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