gitlab.GroupAccessToken
Explore with Pulumi AI
The gitlab_group_access
token resource allows to manage the lifecycle of a group access token.
Group Access Token were introduced in GitLab 14.7
Upstream API: GitLab REST API
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gitlab from "@pulumi/gitlab";
const exampleGroupAccessToken = new gitlab.GroupAccessToken("exampleGroupAccessToken", {
group: "25",
expiresAt: "2020-03-14",
accessLevel: "developer",
scopes: ["api"],
});
const exampleGroupVariable = new gitlab.GroupVariable("exampleGroupVariable", {
group: "25",
key: "gat",
value: exampleGroupAccessToken.token,
});
import pulumi
import pulumi_gitlab as gitlab
example_group_access_token = gitlab.GroupAccessToken("exampleGroupAccessToken",
group="25",
expires_at="2020-03-14",
access_level="developer",
scopes=["api"])
example_group_variable = gitlab.GroupVariable("exampleGroupVariable",
group="25",
key="gat",
value=example_group_access_token.token)
package main
import (
"github.com/pulumi/pulumi-gitlab/sdk/v6/go/gitlab"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleGroupAccessToken, err := gitlab.NewGroupAccessToken(ctx, "exampleGroupAccessToken", &gitlab.GroupAccessTokenArgs{
Group: pulumi.String("25"),
ExpiresAt: pulumi.String("2020-03-14"),
AccessLevel: pulumi.String("developer"),
Scopes: pulumi.StringArray{
pulumi.String("api"),
},
})
if err != nil {
return err
}
_, err = gitlab.NewGroupVariable(ctx, "exampleGroupVariable", &gitlab.GroupVariableArgs{
Group: pulumi.String("25"),
Key: pulumi.String("gat"),
Value: exampleGroupAccessToken.Token,
})
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 exampleGroupAccessToken = new GitLab.GroupAccessToken("exampleGroupAccessToken", new()
{
Group = "25",
ExpiresAt = "2020-03-14",
AccessLevel = "developer",
Scopes = new[]
{
"api",
},
});
var exampleGroupVariable = new GitLab.GroupVariable("exampleGroupVariable", new()
{
Group = "25",
Key = "gat",
Value = exampleGroupAccessToken.Token,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gitlab.GroupAccessToken;
import com.pulumi.gitlab.GroupAccessTokenArgs;
import com.pulumi.gitlab.GroupVariable;
import com.pulumi.gitlab.GroupVariableArgs;
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 exampleGroupAccessToken = new GroupAccessToken("exampleGroupAccessToken", GroupAccessTokenArgs.builder()
.group("25")
.expiresAt("2020-03-14")
.accessLevel("developer")
.scopes("api")
.build());
var exampleGroupVariable = new GroupVariable("exampleGroupVariable", GroupVariableArgs.builder()
.group("25")
.key("gat")
.value(exampleGroupAccessToken.token())
.build());
}
}
resources:
exampleGroupAccessToken:
type: gitlab:GroupAccessToken
properties:
group: '25'
expiresAt: 2020-03-14
accessLevel: developer
scopes:
- api
exampleGroupVariable:
type: gitlab:GroupVariable
properties:
group: '25'
key: gat
value: ${exampleGroupAccessToken.token}
Create GroupAccessToken Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new GroupAccessToken(name: string, args: GroupAccessTokenArgs, opts?: CustomResourceOptions);
@overload
def GroupAccessToken(resource_name: str,
args: GroupAccessTokenArgs,
opts: Optional[ResourceOptions] = None)
@overload
def GroupAccessToken(resource_name: str,
opts: Optional[ResourceOptions] = None,
expires_at: Optional[str] = None,
group: Optional[str] = None,
scopes: Optional[Sequence[str]] = None,
access_level: Optional[str] = None,
name: Optional[str] = None)
func NewGroupAccessToken(ctx *Context, name string, args GroupAccessTokenArgs, opts ...ResourceOption) (*GroupAccessToken, error)
public GroupAccessToken(string name, GroupAccessTokenArgs args, CustomResourceOptions? opts = null)
public GroupAccessToken(String name, GroupAccessTokenArgs args)
public GroupAccessToken(String name, GroupAccessTokenArgs args, CustomResourceOptions options)
type: gitlab:GroupAccessToken
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 GroupAccessTokenArgs
- 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 GroupAccessTokenArgs
- 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 GroupAccessTokenArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args GroupAccessTokenArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args GroupAccessTokenArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Example
The following reference example uses placeholder values for all input properties.
var groupAccessTokenResource = new GitLab.GroupAccessToken("groupAccessTokenResource", new()
{
ExpiresAt = "string",
Group = "string",
Scopes = new[]
{
"string",
},
AccessLevel = "string",
Name = "string",
});
example, err := gitlab.NewGroupAccessToken(ctx, "groupAccessTokenResource", &gitlab.GroupAccessTokenArgs{
ExpiresAt: pulumi.String("string"),
Group: pulumi.String("string"),
Scopes: pulumi.StringArray{
pulumi.String("string"),
},
AccessLevel: pulumi.String("string"),
Name: pulumi.String("string"),
})
var groupAccessTokenResource = new GroupAccessToken("groupAccessTokenResource", GroupAccessTokenArgs.builder()
.expiresAt("string")
.group("string")
.scopes("string")
.accessLevel("string")
.name("string")
.build());
group_access_token_resource = gitlab.GroupAccessToken("groupAccessTokenResource",
expires_at="string",
group="string",
scopes=["string"],
access_level="string",
name="string")
const groupAccessTokenResource = new gitlab.GroupAccessToken("groupAccessTokenResource", {
expiresAt: "string",
group: "string",
scopes: ["string"],
accessLevel: "string",
name: "string",
});
type: gitlab:GroupAccessToken
properties:
accessLevel: string
expiresAt: string
group: string
name: string
scopes:
- string
GroupAccessToken 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 GroupAccessToken resource accepts the following input properties:
- Expires
At string - The token expires at midnight UTC on that date. The date must be in the format YYYY-MM-DD.
- Group string
- The ID or path of the group to add the group access token to.
- Scopes List<string>
- The scope for the group access token. It determines the actions which can be performed when authenticating with this token. Valid values are:
api
,read_api
,read_registry
,write_registry
,read_repository
,write_repository
,create_runner
. - Access
Level string - The access level for the group access token. Valid values are:
guest
,reporter
,developer
,maintainer
,owner
. - Name string
- The name of the group access token.
- Expires
At string - The token expires at midnight UTC on that date. The date must be in the format YYYY-MM-DD.
- Group string
- The ID or path of the group to add the group access token to.
- Scopes []string
- The scope for the group access token. It determines the actions which can be performed when authenticating with this token. Valid values are:
api
,read_api
,read_registry
,write_registry
,read_repository
,write_repository
,create_runner
. - Access
Level string - The access level for the group access token. Valid values are:
guest
,reporter
,developer
,maintainer
,owner
. - Name string
- The name of the group access token.
- expires
At String - The token expires at midnight UTC on that date. The date must be in the format YYYY-MM-DD.
- group String
- The ID or path of the group to add the group access token to.
- scopes List<String>
- The scope for the group access token. It determines the actions which can be performed when authenticating with this token. Valid values are:
api
,read_api
,read_registry
,write_registry
,read_repository
,write_repository
,create_runner
. - access
Level String - The access level for the group access token. Valid values are:
guest
,reporter
,developer
,maintainer
,owner
. - name String
- The name of the group access token.
- expires
At string - The token expires at midnight UTC on that date. The date must be in the format YYYY-MM-DD.
- group string
- The ID or path of the group to add the group access token to.
- scopes string[]
- The scope for the group access token. It determines the actions which can be performed when authenticating with this token. Valid values are:
api
,read_api
,read_registry
,write_registry
,read_repository
,write_repository
,create_runner
. - access
Level string - The access level for the group access token. Valid values are:
guest
,reporter
,developer
,maintainer
,owner
. - name string
- The name of the group access token.
- expires_
at str - The token expires at midnight UTC on that date. The date must be in the format YYYY-MM-DD.
- group str
- The ID or path of the group to add the group access token to.
- scopes Sequence[str]
- The scope for the group access token. It determines the actions which can be performed when authenticating with this token. Valid values are:
api
,read_api
,read_registry
,write_registry
,read_repository
,write_repository
,create_runner
. - access_
level str - The access level for the group access token. Valid values are:
guest
,reporter
,developer
,maintainer
,owner
. - name str
- The name of the group access token.
- expires
At String - The token expires at midnight UTC on that date. The date must be in the format YYYY-MM-DD.
- group String
- The ID or path of the group to add the group access token to.
- scopes List<String>
- The scope for the group access token. It determines the actions which can be performed when authenticating with this token. Valid values are:
api
,read_api
,read_registry
,write_registry
,read_repository
,write_repository
,create_runner
. - access
Level String - The access level for the group access token. Valid values are:
guest
,reporter
,developer
,maintainer
,owner
. - name String
- The name of the group access token.
Outputs
All input properties are implicitly available as output properties. Additionally, the GroupAccessToken resource produces the following output properties:
- Active bool
- True if the token is active.
- Created
At string - Time the token has been created, RFC3339 format.
- Id string
- The provider-assigned unique ID for this managed resource.
- Revoked bool
- True if the token is revoked.
- Token string
- The group access token. This is only populated when creating a new group access token. This attribute is not available for imported resources.
- User
Id int - The user id associated to the token.
- Active bool
- True if the token is active.
- Created
At string - Time the token has been created, RFC3339 format.
- Id string
- The provider-assigned unique ID for this managed resource.
- Revoked bool
- True if the token is revoked.
- Token string
- The group access token. This is only populated when creating a new group access token. This attribute is not available for imported resources.
- User
Id int - The user id associated to the token.
- active Boolean
- True if the token is active.
- created
At String - Time the token has been created, RFC3339 format.
- id String
- The provider-assigned unique ID for this managed resource.
- revoked Boolean
- True if the token is revoked.
- token String
- The group access token. This is only populated when creating a new group access token. This attribute is not available for imported resources.
- user
Id Integer - The user id associated to the token.
- active boolean
- True if the token is active.
- created
At string - Time the token has been created, RFC3339 format.
- id string
- The provider-assigned unique ID for this managed resource.
- revoked boolean
- True if the token is revoked.
- token string
- The group access token. This is only populated when creating a new group access token. This attribute is not available for imported resources.
- user
Id number - The user id associated to the token.
- active bool
- True if the token is active.
- created_
at str - Time the token has been created, RFC3339 format.
- id str
- The provider-assigned unique ID for this managed resource.
- revoked bool
- True if the token is revoked.
- token str
- The group access token. This is only populated when creating a new group access token. This attribute is not available for imported resources.
- user_
id int - The user id associated to the token.
- active Boolean
- True if the token is active.
- created
At String - Time the token has been created, RFC3339 format.
- id String
- The provider-assigned unique ID for this managed resource.
- revoked Boolean
- True if the token is revoked.
- token String
- The group access token. This is only populated when creating a new group access token. This attribute is not available for imported resources.
- user
Id Number - The user id associated to the token.
Look up Existing GroupAccessToken Resource
Get an existing GroupAccessToken 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?: GroupAccessTokenState, opts?: CustomResourceOptions): GroupAccessToken
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
access_level: Optional[str] = None,
active: Optional[bool] = None,
created_at: Optional[str] = None,
expires_at: Optional[str] = None,
group: Optional[str] = None,
name: Optional[str] = None,
revoked: Optional[bool] = None,
scopes: Optional[Sequence[str]] = None,
token: Optional[str] = None,
user_id: Optional[int] = None) -> GroupAccessToken
func GetGroupAccessToken(ctx *Context, name string, id IDInput, state *GroupAccessTokenState, opts ...ResourceOption) (*GroupAccessToken, error)
public static GroupAccessToken Get(string name, Input<string> id, GroupAccessTokenState? state, CustomResourceOptions? opts = null)
public static GroupAccessToken get(String name, Output<String> id, GroupAccessTokenState 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 - The access level for the group access token. Valid values are:
guest
,reporter
,developer
,maintainer
,owner
. - Active bool
- True if the token is active.
- Created
At string - Time the token has been created, RFC3339 format.
- Expires
At string - The token expires at midnight UTC on that date. The date must be in the format YYYY-MM-DD.
- Group string
- The ID or path of the group to add the group access token to.
- Name string
- The name of the group access token.
- Revoked bool
- True if the token is revoked.
- Scopes List<string>
- The scope for the group access token. It determines the actions which can be performed when authenticating with this token. Valid values are:
api
,read_api
,read_registry
,write_registry
,read_repository
,write_repository
,create_runner
. - Token string
- The group access token. This is only populated when creating a new group access token. This attribute is not available for imported resources.
- User
Id int - The user id associated to the token.
- Access
Level string - The access level for the group access token. Valid values are:
guest
,reporter
,developer
,maintainer
,owner
. - Active bool
- True if the token is active.
- Created
At string - Time the token has been created, RFC3339 format.
- Expires
At string - The token expires at midnight UTC on that date. The date must be in the format YYYY-MM-DD.
- Group string
- The ID or path of the group to add the group access token to.
- Name string
- The name of the group access token.
- Revoked bool
- True if the token is revoked.
- Scopes []string
- The scope for the group access token. It determines the actions which can be performed when authenticating with this token. Valid values are:
api
,read_api
,read_registry
,write_registry
,read_repository
,write_repository
,create_runner
. - Token string
- The group access token. This is only populated when creating a new group access token. This attribute is not available for imported resources.
- User
Id int - The user id associated to the token.
- access
Level String - The access level for the group access token. Valid values are:
guest
,reporter
,developer
,maintainer
,owner
. - active Boolean
- True if the token is active.
- created
At String - Time the token has been created, RFC3339 format.
- expires
At String - The token expires at midnight UTC on that date. The date must be in the format YYYY-MM-DD.
- group String
- The ID or path of the group to add the group access token to.
- name String
- The name of the group access token.
- revoked Boolean
- True if the token is revoked.
- scopes List<String>
- The scope for the group access token. It determines the actions which can be performed when authenticating with this token. Valid values are:
api
,read_api
,read_registry
,write_registry
,read_repository
,write_repository
,create_runner
. - token String
- The group access token. This is only populated when creating a new group access token. This attribute is not available for imported resources.
- user
Id Integer - The user id associated to the token.
- access
Level string - The access level for the group access token. Valid values are:
guest
,reporter
,developer
,maintainer
,owner
. - active boolean
- True if the token is active.
- created
At string - Time the token has been created, RFC3339 format.
- expires
At string - The token expires at midnight UTC on that date. The date must be in the format YYYY-MM-DD.
- group string
- The ID or path of the group to add the group access token to.
- name string
- The name of the group access token.
- revoked boolean
- True if the token is revoked.
- scopes string[]
- The scope for the group access token. It determines the actions which can be performed when authenticating with this token. Valid values are:
api
,read_api
,read_registry
,write_registry
,read_repository
,write_repository
,create_runner
. - token string
- The group access token. This is only populated when creating a new group access token. This attribute is not available for imported resources.
- user
Id number - The user id associated to the token.
- access_
level str - The access level for the group access token. Valid values are:
guest
,reporter
,developer
,maintainer
,owner
. - active bool
- True if the token is active.
- created_
at str - Time the token has been created, RFC3339 format.
- expires_
at str - The token expires at midnight UTC on that date. The date must be in the format YYYY-MM-DD.
- group str
- The ID or path of the group to add the group access token to.
- name str
- The name of the group access token.
- revoked bool
- True if the token is revoked.
- scopes Sequence[str]
- The scope for the group access token. It determines the actions which can be performed when authenticating with this token. Valid values are:
api
,read_api
,read_registry
,write_registry
,read_repository
,write_repository
,create_runner
. - token str
- The group access token. This is only populated when creating a new group access token. This attribute is not available for imported resources.
- user_
id int - The user id associated to the token.
- access
Level String - The access level for the group access token. Valid values are:
guest
,reporter
,developer
,maintainer
,owner
. - active Boolean
- True if the token is active.
- created
At String - Time the token has been created, RFC3339 format.
- expires
At String - The token expires at midnight UTC on that date. The date must be in the format YYYY-MM-DD.
- group String
- The ID or path of the group to add the group access token to.
- name String
- The name of the group access token.
- revoked Boolean
- True if the token is revoked.
- scopes List<String>
- The scope for the group access token. It determines the actions which can be performed when authenticating with this token. Valid values are:
api
,read_api
,read_registry
,write_registry
,read_repository
,write_repository
,create_runner
. - token String
- The group access token. This is only populated when creating a new group access token. This attribute is not available for imported resources.
- user
Id Number - The user id associated to the token.
Import
A GitLab Group Access Token can be imported using a key composed of <group-id>:<token-id>
, e.g.
$ pulumi import gitlab:index/groupAccessToken:GroupAccessToken example "12345:1"
ATTENTION: the token
resource attribute is not available for imported resources as this information cannot be read from the GitLab API.
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.