1. Packages
  2. Gitlab Provider
  3. API Docs
  4. GroupMembership
GitLab v8.5.0 published on Friday, Oct 18, 2024 by Pulumi

gitlab.GroupMembership

Explore with Pulumi AI

gitlab logo
GitLab v8.5.0 published on Friday, Oct 18, 2024 by Pulumi

    The gitlab.GroupMembership resource allows to manage the lifecycle of a users group membership.

    If a group should grant membership to another group use the gitlab.GroupShareGroup resource instead.

    Upstream API: GitLab REST API docs

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as gitlab from "@pulumi/gitlab";
    
    const test = new gitlab.GroupMembership("test", {
        groupId: "12345",
        userId: 1337,
        accessLevel: "guest",
        expiresAt: "2020-12-31",
    });
    
    import pulumi
    import pulumi_gitlab as gitlab
    
    test = gitlab.GroupMembership("test",
        group_id="12345",
        user_id=1337,
        access_level="guest",
        expires_at="2020-12-31")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gitlab/sdk/v8/go/gitlab"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := gitlab.NewGroupMembership(ctx, "test", &gitlab.GroupMembershipArgs{
    			GroupId:     pulumi.String("12345"),
    			UserId:      pulumi.Int(1337),
    			AccessLevel: pulumi.String("guest"),
    			ExpiresAt:   pulumi.String("2020-12-31"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using GitLab = Pulumi.GitLab;
    
    return await Deployment.RunAsync(() => 
    {
        var test = new GitLab.GroupMembership("test", new()
        {
            GroupId = "12345",
            UserId = 1337,
            AccessLevel = "guest",
            ExpiresAt = "2020-12-31",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gitlab.GroupMembership;
    import com.pulumi.gitlab.GroupMembershipArgs;
    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 test = new GroupMembership("test", GroupMembershipArgs.builder()
                .groupId("12345")
                .userId(1337)
                .accessLevel("guest")
                .expiresAt("2020-12-31")
                .build());
    
        }
    }
    
    resources:
      test:
        type: gitlab:GroupMembership
        properties:
          groupId: '12345'
          userId: 1337
          accessLevel: guest
          expiresAt: 2020-12-31
    

    Create GroupMembership Resource

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

    Constructor syntax

    new GroupMembership(name: string, args: GroupMembershipArgs, opts?: CustomResourceOptions);
    @overload
    def GroupMembership(resource_name: str,
                        args: GroupMembershipArgs,
                        opts: Optional[ResourceOptions] = None)
    
    @overload
    def GroupMembership(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        access_level: Optional[str] = None,
                        group_id: Optional[str] = None,
                        user_id: Optional[int] = None,
                        expires_at: Optional[str] = None,
                        member_role_id: Optional[int] = None,
                        skip_subresources_on_destroy: Optional[bool] = None,
                        unassign_issuables_on_destroy: Optional[bool] = None)
    func NewGroupMembership(ctx *Context, name string, args GroupMembershipArgs, opts ...ResourceOption) (*GroupMembership, error)
    public GroupMembership(string name, GroupMembershipArgs args, CustomResourceOptions? opts = null)
    public GroupMembership(String name, GroupMembershipArgs args)
    public GroupMembership(String name, GroupMembershipArgs args, CustomResourceOptions options)
    
    type: gitlab:GroupMembership
    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 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.
    name String
    The unique name of the resource.
    args GroupMembershipArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

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

    var groupMembershipResource = new GitLab.GroupMembership("groupMembershipResource", new()
    {
        AccessLevel = "string",
        GroupId = "string",
        UserId = 0,
        ExpiresAt = "string",
        MemberRoleId = 0,
        SkipSubresourcesOnDestroy = false,
        UnassignIssuablesOnDestroy = false,
    });
    
    example, err := gitlab.NewGroupMembership(ctx, "groupMembershipResource", &gitlab.GroupMembershipArgs{
    	AccessLevel:                pulumi.String("string"),
    	GroupId:                    pulumi.String("string"),
    	UserId:                     pulumi.Int(0),
    	ExpiresAt:                  pulumi.String("string"),
    	MemberRoleId:               pulumi.Int(0),
    	SkipSubresourcesOnDestroy:  pulumi.Bool(false),
    	UnassignIssuablesOnDestroy: pulumi.Bool(false),
    })
    
    var groupMembershipResource = new GroupMembership("groupMembershipResource", GroupMembershipArgs.builder()
        .accessLevel("string")
        .groupId("string")
        .userId(0)
        .expiresAt("string")
        .memberRoleId(0)
        .skipSubresourcesOnDestroy(false)
        .unassignIssuablesOnDestroy(false)
        .build());
    
    group_membership_resource = gitlab.GroupMembership("groupMembershipResource",
        access_level="string",
        group_id="string",
        user_id=0,
        expires_at="string",
        member_role_id=0,
        skip_subresources_on_destroy=False,
        unassign_issuables_on_destroy=False)
    
    const groupMembershipResource = new gitlab.GroupMembership("groupMembershipResource", {
        accessLevel: "string",
        groupId: "string",
        userId: 0,
        expiresAt: "string",
        memberRoleId: 0,
        skipSubresourcesOnDestroy: false,
        unassignIssuablesOnDestroy: false,
    });
    
    type: gitlab:GroupMembership
    properties:
        accessLevel: string
        expiresAt: string
        groupId: string
        memberRoleId: 0
        skipSubresourcesOnDestroy: false
        unassignIssuablesOnDestroy: false
        userId: 0
    

    GroupMembership Resource Properties

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

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The GroupMembership resource accepts the following input properties:

    AccessLevel string
    Access level for the member. Valid values are: no one, minimal, guest, reporter, developer, maintainer, owner.
    GroupId string
    The id of the group.
    UserId int
    The id of the user.
    ExpiresAt string
    Expiration date for the group membership. Format: YYYY-MM-DD
    MemberRoleId int
    The ID of a custom member role. Only available for Ultimate instances.
    SkipSubresourcesOnDestroy bool
    Whether the deletion of direct memberships of the removed member in subgroups and projects should be skipped. Only used during a destroy.
    UnassignIssuablesOnDestroy bool
    Whether the removed member should be unassigned from any issues or merge requests inside a given group or project. Only used during a destroy.
    AccessLevel string
    Access level for the member. Valid values are: no one, minimal, guest, reporter, developer, maintainer, owner.
    GroupId string
    The id of the group.
    UserId int
    The id of the user.
    ExpiresAt string
    Expiration date for the group membership. Format: YYYY-MM-DD
    MemberRoleId int
    The ID of a custom member role. Only available for Ultimate instances.
    SkipSubresourcesOnDestroy bool
    Whether the deletion of direct memberships of the removed member in subgroups and projects should be skipped. Only used during a destroy.
    UnassignIssuablesOnDestroy bool
    Whether the removed member should be unassigned from any issues or merge requests inside a given group or project. Only used during a destroy.
    accessLevel String
    Access level for the member. Valid values are: no one, minimal, guest, reporter, developer, maintainer, owner.
    groupId String
    The id of the group.
    userId Integer
    The id of the user.
    expiresAt String
    Expiration date for the group membership. Format: YYYY-MM-DD
    memberRoleId Integer
    The ID of a custom member role. Only available for Ultimate instances.
    skipSubresourcesOnDestroy Boolean
    Whether the deletion of direct memberships of the removed member in subgroups and projects should be skipped. Only used during a destroy.
    unassignIssuablesOnDestroy Boolean
    Whether the removed member should be unassigned from any issues or merge requests inside a given group or project. Only used during a destroy.
    accessLevel string
    Access level for the member. Valid values are: no one, minimal, guest, reporter, developer, maintainer, owner.
    groupId string
    The id of the group.
    userId number
    The id of the user.
    expiresAt string
    Expiration date for the group membership. Format: YYYY-MM-DD
    memberRoleId number
    The ID of a custom member role. Only available for Ultimate instances.
    skipSubresourcesOnDestroy boolean
    Whether the deletion of direct memberships of the removed member in subgroups and projects should be skipped. Only used during a destroy.
    unassignIssuablesOnDestroy boolean
    Whether the removed member should be unassigned from any issues or merge requests inside a given group or project. Only used during a destroy.
    access_level str
    Access level for the member. Valid values are: no one, minimal, guest, reporter, developer, maintainer, owner.
    group_id str
    The id of the group.
    user_id int
    The id of the user.
    expires_at str
    Expiration date for the group membership. Format: YYYY-MM-DD
    member_role_id int
    The ID of a custom member role. Only available for Ultimate instances.
    skip_subresources_on_destroy bool
    Whether the deletion of direct memberships of the removed member in subgroups and projects should be skipped. Only used during a destroy.
    unassign_issuables_on_destroy bool
    Whether the removed member should be unassigned from any issues or merge requests inside a given group or project. Only used during a destroy.
    accessLevel String
    Access level for the member. Valid values are: no one, minimal, guest, reporter, developer, maintainer, owner.
    groupId String
    The id of the group.
    userId Number
    The id of the user.
    expiresAt String
    Expiration date for the group membership. Format: YYYY-MM-DD
    memberRoleId Number
    The ID of a custom member role. Only available for Ultimate instances.
    skipSubresourcesOnDestroy Boolean
    Whether the deletion of direct memberships of the removed member in subgroups and projects should be skipped. Only used during a destroy.
    unassignIssuablesOnDestroy Boolean
    Whether the removed member should be unassigned from any issues or merge requests inside a given group or project. Only used during a destroy.

    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 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 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,
            access_level: Optional[str] = None,
            expires_at: Optional[str] = None,
            group_id: Optional[str] = None,
            member_role_id: Optional[int] = None,
            skip_subresources_on_destroy: Optional[bool] = None,
            unassign_issuables_on_destroy: Optional[bool] = None,
            user_id: Optional[int] = 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)
    public static GroupMembership get(String name, Output<String> id, GroupMembershipState 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:
    AccessLevel string
    Access level for the member. Valid values are: no one, minimal, guest, reporter, developer, maintainer, owner.
    ExpiresAt string
    Expiration date for the group membership. Format: YYYY-MM-DD
    GroupId string
    The id of the group.
    MemberRoleId int
    The ID of a custom member role. Only available for Ultimate instances.
    SkipSubresourcesOnDestroy bool
    Whether the deletion of direct memberships of the removed member in subgroups and projects should be skipped. Only used during a destroy.
    UnassignIssuablesOnDestroy bool
    Whether the removed member should be unassigned from any issues or merge requests inside a given group or project. Only used during a destroy.
    UserId int
    The id of the user.
    AccessLevel string
    Access level for the member. Valid values are: no one, minimal, guest, reporter, developer, maintainer, owner.
    ExpiresAt string
    Expiration date for the group membership. Format: YYYY-MM-DD
    GroupId string
    The id of the group.
    MemberRoleId int
    The ID of a custom member role. Only available for Ultimate instances.
    SkipSubresourcesOnDestroy bool
    Whether the deletion of direct memberships of the removed member in subgroups and projects should be skipped. Only used during a destroy.
    UnassignIssuablesOnDestroy bool
    Whether the removed member should be unassigned from any issues or merge requests inside a given group or project. Only used during a destroy.
    UserId int
    The id of the user.
    accessLevel String
    Access level for the member. Valid values are: no one, minimal, guest, reporter, developer, maintainer, owner.
    expiresAt String
    Expiration date for the group membership. Format: YYYY-MM-DD
    groupId String
    The id of the group.
    memberRoleId Integer
    The ID of a custom member role. Only available for Ultimate instances.
    skipSubresourcesOnDestroy Boolean
    Whether the deletion of direct memberships of the removed member in subgroups and projects should be skipped. Only used during a destroy.
    unassignIssuablesOnDestroy Boolean
    Whether the removed member should be unassigned from any issues or merge requests inside a given group or project. Only used during a destroy.
    userId Integer
    The id of the user.
    accessLevel string
    Access level for the member. Valid values are: no one, minimal, guest, reporter, developer, maintainer, owner.
    expiresAt string
    Expiration date for the group membership. Format: YYYY-MM-DD
    groupId string
    The id of the group.
    memberRoleId number
    The ID of a custom member role. Only available for Ultimate instances.
    skipSubresourcesOnDestroy boolean
    Whether the deletion of direct memberships of the removed member in subgroups and projects should be skipped. Only used during a destroy.
    unassignIssuablesOnDestroy boolean
    Whether the removed member should be unassigned from any issues or merge requests inside a given group or project. Only used during a destroy.
    userId number
    The id of the user.
    access_level str
    Access level for the member. Valid values are: no one, minimal, guest, reporter, developer, maintainer, owner.
    expires_at str
    Expiration date for the group membership. Format: YYYY-MM-DD
    group_id str
    The id of the group.
    member_role_id int
    The ID of a custom member role. Only available for Ultimate instances.
    skip_subresources_on_destroy bool
    Whether the deletion of direct memberships of the removed member in subgroups and projects should be skipped. Only used during a destroy.
    unassign_issuables_on_destroy bool
    Whether the removed member should be unassigned from any issues or merge requests inside a given group or project. Only used during a destroy.
    user_id int
    The id of the user.
    accessLevel String
    Access level for the member. Valid values are: no one, minimal, guest, reporter, developer, maintainer, owner.
    expiresAt String
    Expiration date for the group membership. Format: YYYY-MM-DD
    groupId String
    The id of the group.
    memberRoleId Number
    The ID of a custom member role. Only available for Ultimate instances.
    skipSubresourcesOnDestroy Boolean
    Whether the deletion of direct memberships of the removed member in subgroups and projects should be skipped. Only used during a destroy.
    unassignIssuablesOnDestroy Boolean
    Whether the removed member should be unassigned from any issues or merge requests inside a given group or project. Only used during a destroy.
    userId Number
    The id of the user.

    Import

    GitLab group membership can be imported using an id made up of group_id:user_id, e.g.

    $ pulumi import gitlab:index/groupMembership:GroupMembership test "12345:1337"
    

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

    Package Details

    Repository
    GitLab pulumi/pulumi-gitlab
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the gitlab Terraform Provider.
    gitlab logo
    GitLab v8.5.0 published on Friday, Oct 18, 2024 by Pulumi