gitlab.GroupMembership
Explore with Pulumi AI
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:
- Access
Level string - Access level for the member. Valid values are:
no one
,minimal
,guest
,reporter
,developer
,maintainer
,owner
. - Group
Id string - The id of the group.
- User
Id int - The id of the user.
- Expires
At string - Expiration date for the group membership. Format:
YYYY-MM-DD
- Member
Role intId - The ID of a custom member role. Only available for Ultimate instances.
- Skip
Subresources boolOn Destroy - Whether the deletion of direct memberships of the removed member in subgroups and projects should be skipped. Only used during a destroy.
- Unassign
Issuables boolOn Destroy - 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 string - Access level for the member. Valid values are:
no one
,minimal
,guest
,reporter
,developer
,maintainer
,owner
. - Group
Id string - The id of the group.
- User
Id int - The id of the user.
- Expires
At string - Expiration date for the group membership. Format:
YYYY-MM-DD
- Member
Role intId - The ID of a custom member role. Only available for Ultimate instances.
- Skip
Subresources boolOn Destroy - Whether the deletion of direct memberships of the removed member in subgroups and projects should be skipped. Only used during a destroy.
- Unassign
Issuables boolOn Destroy - 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 String - Access level for the member. Valid values are:
no one
,minimal
,guest
,reporter
,developer
,maintainer
,owner
. - group
Id String - The id of the group.
- user
Id Integer - The id of the user.
- expires
At String - Expiration date for the group membership. Format:
YYYY-MM-DD
- member
Role IntegerId - The ID of a custom member role. Only available for Ultimate instances.
- skip
Subresources BooleanOn Destroy - Whether the deletion of direct memberships of the removed member in subgroups and projects should be skipped. Only used during a destroy.
- unassign
Issuables BooleanOn Destroy - 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 string - Access level for the member. Valid values are:
no one
,minimal
,guest
,reporter
,developer
,maintainer
,owner
. - group
Id string - The id of the group.
- user
Id number - The id of the user.
- expires
At string - Expiration date for the group membership. Format:
YYYY-MM-DD
- member
Role numberId - The ID of a custom member role. Only available for Ultimate instances.
- skip
Subresources booleanOn Destroy - Whether the deletion of direct memberships of the removed member in subgroups and projects should be skipped. Only used during a destroy.
- unassign
Issuables booleanOn Destroy - 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_ intid - The ID of a custom member role. Only available for Ultimate instances.
- skip_
subresources_ boolon_ destroy - Whether the deletion of direct memberships of the removed member in subgroups and projects should be skipped. Only used during a destroy.
- unassign_
issuables_ boolon_ destroy - 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 String - Access level for the member. Valid values are:
no one
,minimal
,guest
,reporter
,developer
,maintainer
,owner
. - group
Id String - The id of the group.
- user
Id Number - The id of the user.
- expires
At String - Expiration date for the group membership. Format:
YYYY-MM-DD
- member
Role NumberId - The ID of a custom member role. Only available for Ultimate instances.
- skip
Subresources BooleanOn Destroy - Whether the deletion of direct memberships of the removed member in subgroups and projects should be skipped. Only used during a destroy.
- unassign
Issuables BooleanOn Destroy - 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.
- Access
Level string - Access level for the member. Valid values are:
no one
,minimal
,guest
,reporter
,developer
,maintainer
,owner
. - Expires
At string - Expiration date for the group membership. Format:
YYYY-MM-DD
- Group
Id string - The id of the group.
- Member
Role intId - The ID of a custom member role. Only available for Ultimate instances.
- Skip
Subresources boolOn Destroy - Whether the deletion of direct memberships of the removed member in subgroups and projects should be skipped. Only used during a destroy.
- Unassign
Issuables boolOn Destroy - 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.
- Access
Level string - Access level for the member. Valid values are:
no one
,minimal
,guest
,reporter
,developer
,maintainer
,owner
. - Expires
At string - Expiration date for the group membership. Format:
YYYY-MM-DD
- Group
Id string - The id of the group.
- Member
Role intId - The ID of a custom member role. Only available for Ultimate instances.
- Skip
Subresources boolOn Destroy - Whether the deletion of direct memberships of the removed member in subgroups and projects should be skipped. Only used during a destroy.
- Unassign
Issuables boolOn Destroy - 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.
- access
Level String - Access level for the member. Valid values are:
no one
,minimal
,guest
,reporter
,developer
,maintainer
,owner
. - expires
At String - Expiration date for the group membership. Format:
YYYY-MM-DD
- group
Id String - The id of the group.
- member
Role IntegerId - The ID of a custom member role. Only available for Ultimate instances.
- skip
Subresources BooleanOn Destroy - Whether the deletion of direct memberships of the removed member in subgroups and projects should be skipped. Only used during a destroy.
- unassign
Issuables BooleanOn Destroy - 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 Integer - The id of the user.
- access
Level string - Access level for the member. Valid values are:
no one
,minimal
,guest
,reporter
,developer
,maintainer
,owner
. - expires
At string - Expiration date for the group membership. Format:
YYYY-MM-DD
- group
Id string - The id of the group.
- member
Role numberId - The ID of a custom member role. Only available for Ultimate instances.
- skip
Subresources booleanOn Destroy - Whether the deletion of direct memberships of the removed member in subgroups and projects should be skipped. Only used during a destroy.
- unassign
Issuables booleanOn Destroy - 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 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_ intid - The ID of a custom member role. Only available for Ultimate instances.
- skip_
subresources_ boolon_ destroy - Whether the deletion of direct memberships of the removed member in subgroups and projects should be skipped. Only used during a destroy.
- unassign_
issuables_ boolon_ destroy - 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.
- access
Level String - Access level for the member. Valid values are:
no one
,minimal
,guest
,reporter
,developer
,maintainer
,owner
. - expires
At String - Expiration date for the group membership. Format:
YYYY-MM-DD
- group
Id String - The id of the group.
- member
Role NumberId - The ID of a custom member role. Only available for Ultimate instances.
- skip
Subresources BooleanOn Destroy - Whether the deletion of direct memberships of the removed member in subgroups and projects should be skipped. Only used during a destroy.
- unassign
Issuables BooleanOn Destroy - 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 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.