GroupMembership

A Membership defines a relationship between a Group and an entity belonging to that Group, referred to as a “member”.

To get more information about GroupMembership, see:

Warning: If you are using User ADCs (Application Default Credentials) with this resource, you must specify a billing_project and set user_project_override to true in the provider configuration. Otherwise the Cloud Identity API will return a 403 error. Your account must have the serviceusage.services.use permission on the billing_project you defined.

Example Usage

Cloud Identity Group Membership User

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
    public MyStack()
    {
        var @group = new Gcp.CloudIdentity.Group("group", new Gcp.CloudIdentity.GroupArgs
        {
            DisplayName = "my-identity-group",
            Parent = "customers/A01b123xz",
            GroupKey = new Gcp.CloudIdentity.Inputs.GroupGroupKeyArgs
            {
                Id = "my-identity-group@example.com",
            },
            Labels = 
            {
                { "cloudidentity.googleapis.com/groups.discussion_forum", "" },
            },
        });
        var cloudIdentityGroupMembershipBasic = new Gcp.CloudIdentity.GroupMembership("cloudIdentityGroupMembershipBasic", new Gcp.CloudIdentity.GroupMembershipArgs
        {
            Group = @group.Id,
            PreferredMemberKey = new Gcp.CloudIdentity.Inputs.GroupMembershipPreferredMemberKeyArgs
            {
                Id = "cloud_identity_user@example.com",
            },
            Roles = 
            {
                new Gcp.CloudIdentity.Inputs.GroupMembershipRoleArgs
                {
                    Name = "MEMBER",
                },
                new Gcp.CloudIdentity.Inputs.GroupMembershipRoleArgs
                {
                    Name = "MANAGER",
                },
            },
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v5/go/gcp/cloudidentity"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		group, err := cloudidentity.NewGroup(ctx, "group", &cloudidentity.GroupArgs{
			DisplayName: pulumi.String("my-identity-group"),
			Parent:      pulumi.String("customers/A01b123xz"),
			GroupKey: &cloudidentity.GroupGroupKeyArgs{
				Id: pulumi.String("my-identity-group@example.com"),
			},
			Labels: pulumi.StringMap{
				"cloudidentity.googleapis.com/groups.discussion_forum": pulumi.String(""),
			},
		})
		if err != nil {
			return err
		}
		_, err = cloudidentity.NewGroupMembership(ctx, "cloudIdentityGroupMembershipBasic", &cloudidentity.GroupMembershipArgs{
			Group: group.ID(),
			PreferredMemberKey: &cloudidentity.GroupMembershipPreferredMemberKeyArgs{
				Id: pulumi.String("cloud_identity_user@example.com"),
			},
			Roles: cloudidentity.GroupMembershipRoleArray{
				&cloudidentity.GroupMembershipRoleArgs{
					Name: pulumi.String("MEMBER"),
				},
				&cloudidentity.GroupMembershipRoleArgs{
					Name: pulumi.String("MANAGER"),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_gcp as gcp

group = gcp.cloudidentity.Group("group",
    display_name="my-identity-group",
    parent="customers/A01b123xz",
    group_key=gcp.cloudidentity.GroupGroupKeyArgs(
        id="my-identity-group@example.com",
    ),
    labels={
        "cloudidentity.googleapis.com/groups.discussion_forum": "",
    })
cloud_identity_group_membership_basic = gcp.cloudidentity.GroupMembership("cloudIdentityGroupMembershipBasic",
    group=group.id,
    preferred_member_key=gcp.cloudidentity.GroupMembershipPreferredMemberKeyArgs(
        id="cloud_identity_user@example.com",
    ),
    roles=[
        gcp.cloudidentity.GroupMembershipRoleArgs(
            name="MEMBER",
        ),
        gcp.cloudidentity.GroupMembershipRoleArgs(
            name="MANAGER",
        ),
    ])
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const group = new gcp.cloudidentity.Group("group", {
    displayName: "my-identity-group",
    parent: "customers/A01b123xz",
    groupKey: {
        id: "my-identity-group@example.com",
    },
    labels: {
        "cloudidentity.googleapis.com/groups.discussion_forum": "",
    },
});
const cloudIdentityGroupMembershipBasic = new gcp.cloudidentity.GroupMembership("cloudIdentityGroupMembershipBasic", {
    group: group.id,
    preferredMemberKey: {
        id: "cloud_identity_user@example.com",
    },
    roles: [
        {
            name: "MEMBER",
        },
        {
            name: "MANAGER",
        },
    ],
});

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,
                    member_key: Optional[GroupMembershipMemberKeyArgs] = None,
                    preferred_member_key: Optional[GroupMembershipPreferredMemberKeyArgs] = None,
                    roles: Optional[Sequence[GroupMembershipRoleArgs]] = 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 name of the Group to create this membership in.
Roles List<GroupMembershipRoleArgs>
The MembershipRoles that apply to the Membership. Must not contain duplicate MembershipRoles with the same name. Structure is documented below.
MemberKey GroupMembershipMemberKeyArgs
EntityKey of the member. Structure is documented below.
PreferredMemberKey GroupMembershipPreferredMemberKeyArgs
EntityKey of the member. Structure is documented below.
Group string
The name of the Group to create this membership in.
Roles []GroupMembershipRole
The MembershipRoles that apply to the Membership. Must not contain duplicate MembershipRoles with the same name. Structure is documented below.
MemberKey GroupMembershipMemberKey
EntityKey of the member. Structure is documented below.
PreferredMemberKey GroupMembershipPreferredMemberKey
EntityKey of the member. Structure is documented below.
group string
The name of the Group to create this membership in.
roles GroupMembershipRoleArgs[]
The MembershipRoles that apply to the Membership. Must not contain duplicate MembershipRoles with the same name. Structure is documented below.
memberKey GroupMembershipMemberKeyArgs
EntityKey of the member. Structure is documented below.
preferredMemberKey GroupMembershipPreferredMemberKeyArgs
EntityKey of the member. Structure is documented below.
group str
The name of the Group to create this membership in.
roles Sequence[GroupMembershipRoleArgs]
The MembershipRoles that apply to the Membership. Must not contain duplicate MembershipRoles with the same name. Structure is documented below.
member_key GroupMembershipMemberKeyArgs
EntityKey of the member. Structure is documented below.
preferred_member_key GroupMembershipPreferredMemberKeyArgs
EntityKey of the member. Structure is documented below.

Outputs

All input properties are implicitly available as output properties. Additionally, the GroupMembership resource produces the following output properties:

CreateTime string
The time when the Membership was created.
Id string
The provider-assigned unique ID for this managed resource.
Name string
The name of the MembershipRole. Must be one of OWNER, MANAGER, MEMBER. Possible values are OWNER, MANAGER, and MEMBER.
Type string
The type of the membership.
UpdateTime string
The time when the Membership was last updated.
CreateTime string
The time when the Membership was created.
Id string
The provider-assigned unique ID for this managed resource.
Name string
The name of the MembershipRole. Must be one of OWNER, MANAGER, MEMBER. Possible values are OWNER, MANAGER, and MEMBER.
Type string
The type of the membership.
UpdateTime string
The time when the Membership was last updated.
createTime string
The time when the Membership was created.
id string
The provider-assigned unique ID for this managed resource.
name string
The name of the MembershipRole. Must be one of OWNER, MANAGER, MEMBER. Possible values are OWNER, MANAGER, and MEMBER.
type string
The type of the membership.
updateTime string
The time when the Membership was last updated.
create_time str
The time when the Membership was created.
id str
The provider-assigned unique ID for this managed resource.
name str
The name of the MembershipRole. Must be one of OWNER, MANAGER, MEMBER. Possible values are OWNER, MANAGER, and MEMBER.
type str
The type of the membership.
update_time str
The time when the Membership was last updated.

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,
        create_time: Optional[str] = None,
        group: Optional[str] = None,
        member_key: Optional[GroupMembershipMemberKeyArgs] = None,
        name: Optional[str] = None,
        preferred_member_key: Optional[GroupMembershipPreferredMemberKeyArgs] = None,
        roles: Optional[Sequence[GroupMembershipRoleArgs]] = None,
        type: Optional[str] = None,
        update_time: Optional[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:

CreateTime string
The time when the Membership was created.
Group string
The name of the Group to create this membership in.
MemberKey GroupMembershipMemberKeyArgs
EntityKey of the member. Structure is documented below.
Name string
The name of the MembershipRole. Must be one of OWNER, MANAGER, MEMBER. Possible values are OWNER, MANAGER, and MEMBER.
PreferredMemberKey GroupMembershipPreferredMemberKeyArgs
EntityKey of the member. Structure is documented below.
Roles List<GroupMembershipRoleArgs>
The MembershipRoles that apply to the Membership. Must not contain duplicate MembershipRoles with the same name. Structure is documented below.
Type string
The type of the membership.
UpdateTime string
The time when the Membership was last updated.
CreateTime string
The time when the Membership was created.
Group string
The name of the Group to create this membership in.
MemberKey GroupMembershipMemberKey
EntityKey of the member. Structure is documented below.
Name string
The name of the MembershipRole. Must be one of OWNER, MANAGER, MEMBER. Possible values are OWNER, MANAGER, and MEMBER.
PreferredMemberKey GroupMembershipPreferredMemberKey
EntityKey of the member. Structure is documented below.
Roles []GroupMembershipRole
The MembershipRoles that apply to the Membership. Must not contain duplicate MembershipRoles with the same name. Structure is documented below.
Type string
The type of the membership.
UpdateTime string
The time when the Membership was last updated.
createTime string
The time when the Membership was created.
group string
The name of the Group to create this membership in.
memberKey GroupMembershipMemberKeyArgs
EntityKey of the member. Structure is documented below.
name string
The name of the MembershipRole. Must be one of OWNER, MANAGER, MEMBER. Possible values are OWNER, MANAGER, and MEMBER.
preferredMemberKey GroupMembershipPreferredMemberKeyArgs
EntityKey of the member. Structure is documented below.
roles GroupMembershipRoleArgs[]
The MembershipRoles that apply to the Membership. Must not contain duplicate MembershipRoles with the same name. Structure is documented below.
type string
The type of the membership.
updateTime string
The time when the Membership was last updated.
create_time str
The time when the Membership was created.
group str
The name of the Group to create this membership in.
member_key GroupMembershipMemberKeyArgs
EntityKey of the member. Structure is documented below.
name str
The name of the MembershipRole. Must be one of OWNER, MANAGER, MEMBER. Possible values are OWNER, MANAGER, and MEMBER.
preferred_member_key GroupMembershipPreferredMemberKeyArgs
EntityKey of the member. Structure is documented below.
roles Sequence[GroupMembershipRoleArgs]
The MembershipRoles that apply to the Membership. Must not contain duplicate MembershipRoles with the same name. Structure is documented below.
type str
The type of the membership.
update_time str
The time when the Membership was last updated.

Supporting Types

GroupMembershipMemberKey

Id string
The ID of the entity. For Google-managed entities, the id must be the email address of an existing group or user. For external-identity-mapped entities, the id must be a string conforming to the Identity Source’s requirements. Must be unique within a namespace.
Namespace string
The namespace in which the entity exists. If not specified, the EntityKey represents a Google-managed entity such as a Google user or a Google Group. If specified, the EntityKey represents an external-identity-mapped group. The namespace must correspond to an identity source created in Admin Console and must be in the form of identitysources/{identity_source_id}.
Id string
The ID of the entity. For Google-managed entities, the id must be the email address of an existing group or user. For external-identity-mapped entities, the id must be a string conforming to the Identity Source’s requirements. Must be unique within a namespace.
Namespace string
The namespace in which the entity exists. If not specified, the EntityKey represents a Google-managed entity such as a Google user or a Google Group. If specified, the EntityKey represents an external-identity-mapped group. The namespace must correspond to an identity source created in Admin Console and must be in the form of identitysources/{identity_source_id}.
id string
The ID of the entity. For Google-managed entities, the id must be the email address of an existing group or user. For external-identity-mapped entities, the id must be a string conforming to the Identity Source’s requirements. Must be unique within a namespace.
namespace string
The namespace in which the entity exists. If not specified, the EntityKey represents a Google-managed entity such as a Google user or a Google Group. If specified, the EntityKey represents an external-identity-mapped group. The namespace must correspond to an identity source created in Admin Console and must be in the form of identitysources/{identity_source_id}.
id str
The ID of the entity. For Google-managed entities, the id must be the email address of an existing group or user. For external-identity-mapped entities, the id must be a string conforming to the Identity Source’s requirements. Must be unique within a namespace.
namespace str
The namespace in which the entity exists. If not specified, the EntityKey represents a Google-managed entity such as a Google user or a Google Group. If specified, the EntityKey represents an external-identity-mapped group. The namespace must correspond to an identity source created in Admin Console and must be in the form of identitysources/{identity_source_id}.

GroupMembershipPreferredMemberKey

Id string
The ID of the entity. For Google-managed entities, the id must be the email address of an existing group or user. For external-identity-mapped entities, the id must be a string conforming to the Identity Source’s requirements. Must be unique within a namespace.
Namespace string
The namespace in which the entity exists. If not specified, the EntityKey represents a Google-managed entity such as a Google user or a Google Group. If specified, the EntityKey represents an external-identity-mapped group. The namespace must correspond to an identity source created in Admin Console and must be in the form of identitysources/{identity_source_id}.
Id string
The ID of the entity. For Google-managed entities, the id must be the email address of an existing group or user. For external-identity-mapped entities, the id must be a string conforming to the Identity Source’s requirements. Must be unique within a namespace.
Namespace string
The namespace in which the entity exists. If not specified, the EntityKey represents a Google-managed entity such as a Google user or a Google Group. If specified, the EntityKey represents an external-identity-mapped group. The namespace must correspond to an identity source created in Admin Console and must be in the form of identitysources/{identity_source_id}.
id string
The ID of the entity. For Google-managed entities, the id must be the email address of an existing group or user. For external-identity-mapped entities, the id must be a string conforming to the Identity Source’s requirements. Must be unique within a namespace.
namespace string
The namespace in which the entity exists. If not specified, the EntityKey represents a Google-managed entity such as a Google user or a Google Group. If specified, the EntityKey represents an external-identity-mapped group. The namespace must correspond to an identity source created in Admin Console and must be in the form of identitysources/{identity_source_id}.
id str
The ID of the entity. For Google-managed entities, the id must be the email address of an existing group or user. For external-identity-mapped entities, the id must be a string conforming to the Identity Source’s requirements. Must be unique within a namespace.
namespace str
The namespace in which the entity exists. If not specified, the EntityKey represents a Google-managed entity such as a Google user or a Google Group. If specified, the EntityKey represents an external-identity-mapped group. The namespace must correspond to an identity source created in Admin Console and must be in the form of identitysources/{identity_source_id}.

GroupMembershipRole

Name string
The name of the MembershipRole. Must be one of OWNER, MANAGER, MEMBER. Possible values are OWNER, MANAGER, and MEMBER.
Name string
The name of the MembershipRole. Must be one of OWNER, MANAGER, MEMBER. Possible values are OWNER, MANAGER, and MEMBER.
name string
The name of the MembershipRole. Must be one of OWNER, MANAGER, MEMBER. Possible values are OWNER, MANAGER, and MEMBER.
name str
The name of the MembershipRole. Must be one of OWNER, MANAGER, MEMBER. Possible values are OWNER, MANAGER, and MEMBER.

Import

GroupMembership can be imported using any of these accepted formats

 $ pulumi import gcp:cloudidentity/groupMembership:GroupMembership default {{name}}

Package Details

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