gitlab.GroupAccessToken
Explore with Pulumi AI
The gitlab.GroupAccessToken
resource allows to manage the lifecycle of a group access token.
Observability scopes are in beta and may not work on all instances. See more details in the documentation
Use
rotation_configuration
to automatically rotate tokens instead of usingtimestamp()
as timestamp will cause changes with every plan.pulumi up
must still be run to rotate the token.
Due to Automatic reuse detection it’s possible that a new Group Access Token will immediately be revoked. Check if an old process using the old token is running if this happens.
Upstream API: GitLab REST API
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gitlab from "@pulumi/gitlab";
const example = new gitlab.GroupAccessToken("example", {
group: "25",
name: "Example group access token",
expiresAt: "2020-03-14",
accessLevel: "developer",
scopes: ["api"],
});
const exampleGroupVariable = new gitlab.GroupVariable("example", {
group: "25",
key: "gat",
value: example.token,
});
import pulumi
import pulumi_gitlab as gitlab
example = gitlab.GroupAccessToken("example",
group="25",
name="Example group access token",
expires_at="2020-03-14",
access_level="developer",
scopes=["api"])
example_group_variable = gitlab.GroupVariable("example",
group="25",
key="gat",
value=example.token)
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 {
example, err := gitlab.NewGroupAccessToken(ctx, "example", &gitlab.GroupAccessTokenArgs{
Group: pulumi.String("25"),
Name: pulumi.String("Example group access token"),
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, "example", &gitlab.GroupVariableArgs{
Group: pulumi.String("25"),
Key: pulumi.String("gat"),
Value: example.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 example = new GitLab.GroupAccessToken("example", new()
{
Group = "25",
Name = "Example group access token",
ExpiresAt = "2020-03-14",
AccessLevel = "developer",
Scopes = new[]
{
"api",
},
});
var exampleGroupVariable = new GitLab.GroupVariable("example", new()
{
Group = "25",
Key = "gat",
Value = example.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 example = new GroupAccessToken("example", GroupAccessTokenArgs.builder()
.group("25")
.name("Example group access token")
.expiresAt("2020-03-14")
.accessLevel("developer")
.scopes("api")
.build());
var exampleGroupVariable = new GroupVariable("exampleGroupVariable", GroupVariableArgs.builder()
.group("25")
.key("gat")
.value(example.token())
.build());
}
}
resources:
example:
type: gitlab:GroupAccessToken
properties:
group: '25'
name: Example group access token
expiresAt: 2020-03-14
accessLevel: developer
scopes:
- api
exampleGroupVariable:
type: gitlab:GroupVariable
name: example
properties:
group: '25'
key: gat
value: ${example.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,
group: Optional[str] = None,
scopes: Optional[Sequence[str]] = None,
access_level: Optional[str] = None,
expires_at: Optional[str] = None,
name: Optional[str] = None,
rotation_configuration: Optional[GroupAccessTokenRotationConfigurationArgs] = 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var groupAccessTokenResource = new GitLab.GroupAccessToken("groupAccessTokenResource", new()
{
Group = "string",
Scopes = new[]
{
"string",
},
AccessLevel = "string",
ExpiresAt = "string",
Name = "string",
RotationConfiguration = new GitLab.Inputs.GroupAccessTokenRotationConfigurationArgs
{
ExpirationDays = 0,
RotateBeforeDays = 0,
},
});
example, err := gitlab.NewGroupAccessToken(ctx, "groupAccessTokenResource", &gitlab.GroupAccessTokenArgs{
Group: pulumi.String("string"),
Scopes: pulumi.StringArray{
pulumi.String("string"),
},
AccessLevel: pulumi.String("string"),
ExpiresAt: pulumi.String("string"),
Name: pulumi.String("string"),
RotationConfiguration: &gitlab.GroupAccessTokenRotationConfigurationArgs{
ExpirationDays: pulumi.Int(0),
RotateBeforeDays: pulumi.Int(0),
},
})
var groupAccessTokenResource = new GroupAccessToken("groupAccessTokenResource", GroupAccessTokenArgs.builder()
.group("string")
.scopes("string")
.accessLevel("string")
.expiresAt("string")
.name("string")
.rotationConfiguration(GroupAccessTokenRotationConfigurationArgs.builder()
.expirationDays(0)
.rotateBeforeDays(0)
.build())
.build());
group_access_token_resource = gitlab.GroupAccessToken("groupAccessTokenResource",
group="string",
scopes=["string"],
access_level="string",
expires_at="string",
name="string",
rotation_configuration={
"expiration_days": 0,
"rotate_before_days": 0,
})
const groupAccessTokenResource = new gitlab.GroupAccessToken("groupAccessTokenResource", {
group: "string",
scopes: ["string"],
accessLevel: "string",
expiresAt: "string",
name: "string",
rotationConfiguration: {
expirationDays: 0,
rotateBeforeDays: 0,
},
});
type: gitlab:GroupAccessToken
properties:
accessLevel: string
expiresAt: string
group: string
name: string
rotationConfiguration:
expirationDays: 0
rotateBeforeDays: 0
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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The GroupAccessToken resource accepts the following input properties:
- Group string
- The ID or full path of the group.
- Scopes List<string>
- The scopes of the group access token. Valid values are:
api
,read_api
,read_registry
,write_registry
,read_repository
,write_repository
,create_runner
,manage_runner
,ai_features
,k8s_proxy
,read_observability
,write_observability
- Access
Level string - The access level for the group access token. Valid values are:
no one
,minimal
,guest
,reporter
,developer
,maintainer
,owner
. Default ismaintainer
. - Expires
At string - When the token will expire, YYYY-MM-DD format.
- Name string
- The name of the group access token.
- Rotation
Configuration Pulumi.Git Lab. Inputs. Group Access Token Rotation Configuration - The configuration for when to rotate a token automatically. Will not rotate a token until
pulumi up
is run.
- Group string
- The ID or full path of the group.
- Scopes []string
- The scopes of the group access token. Valid values are:
api
,read_api
,read_registry
,write_registry
,read_repository
,write_repository
,create_runner
,manage_runner
,ai_features
,k8s_proxy
,read_observability
,write_observability
- Access
Level string - The access level for the group access token. Valid values are:
no one
,minimal
,guest
,reporter
,developer
,maintainer
,owner
. Default ismaintainer
. - Expires
At string - When the token will expire, YYYY-MM-DD format.
- Name string
- The name of the group access token.
- Rotation
Configuration GroupAccess Token Rotation Configuration Args - The configuration for when to rotate a token automatically. Will not rotate a token until
pulumi up
is run.
- group String
- The ID or full path of the group.
- scopes List<String>
- The scopes of the group access token. Valid values are:
api
,read_api
,read_registry
,write_registry
,read_repository
,write_repository
,create_runner
,manage_runner
,ai_features
,k8s_proxy
,read_observability
,write_observability
- access
Level String - The access level for the group access token. Valid values are:
no one
,minimal
,guest
,reporter
,developer
,maintainer
,owner
. Default ismaintainer
. - expires
At String - When the token will expire, YYYY-MM-DD format.
- name String
- The name of the group access token.
- rotation
Configuration GroupAccess Token Rotation Configuration - The configuration for when to rotate a token automatically. Will not rotate a token until
pulumi up
is run.
- group string
- The ID or full path of the group.
- scopes string[]
- The scopes of the group access token. Valid values are:
api
,read_api
,read_registry
,write_registry
,read_repository
,write_repository
,create_runner
,manage_runner
,ai_features
,k8s_proxy
,read_observability
,write_observability
- access
Level string - The access level for the group access token. Valid values are:
no one
,minimal
,guest
,reporter
,developer
,maintainer
,owner
. Default ismaintainer
. - expires
At string - When the token will expire, YYYY-MM-DD format.
- name string
- The name of the group access token.
- rotation
Configuration GroupAccess Token Rotation Configuration - The configuration for when to rotate a token automatically. Will not rotate a token until
pulumi up
is run.
- group str
- The ID or full path of the group.
- scopes Sequence[str]
- The scopes of the group access token. Valid values are:
api
,read_api
,read_registry
,write_registry
,read_repository
,write_repository
,create_runner
,manage_runner
,ai_features
,k8s_proxy
,read_observability
,write_observability
- access_
level str - The access level for the group access token. Valid values are:
no one
,minimal
,guest
,reporter
,developer
,maintainer
,owner
. Default ismaintainer
. - expires_
at str - When the token will expire, YYYY-MM-DD format.
- name str
- The name of the group access token.
- rotation_
configuration GroupAccess Token Rotation Configuration Args - The configuration for when to rotate a token automatically. Will not rotate a token until
pulumi up
is run.
- group String
- The ID or full path of the group.
- scopes List<String>
- The scopes of the group access token. Valid values are:
api
,read_api
,read_registry
,write_registry
,read_repository
,write_repository
,create_runner
,manage_runner
,ai_features
,k8s_proxy
,read_observability
,write_observability
- access
Level String - The access level for the group access token. Valid values are:
no one
,minimal
,guest
,reporter
,developer
,maintainer
,owner
. Default ismaintainer
. - expires
At String - When the token will expire, YYYY-MM-DD format.
- name String
- The name of the group access token.
- rotation
Configuration Property Map - The configuration for when to rotate a token automatically. Will not rotate a token until
pulumi up
is run.
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 token of the group access token. Note: the token 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 token of the group access token. Note: the token 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 token of the group access token. Note: the token 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 token of the group access token. Note: the token 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 token of the group access token. Note: the token 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 token of the group access token. Note: the token 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,
rotation_configuration: Optional[GroupAccessTokenRotationConfigurationArgs] = 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:
no one
,minimal
,guest
,reporter
,developer
,maintainer
,owner
. Default ismaintainer
. - Active bool
- True if the token is active.
- Created
At string - Time the token has been created, RFC3339 format.
- Expires
At string - When the token will expire, YYYY-MM-DD format.
- Group string
- The ID or full path of the group.
- Name string
- The name of the group access token.
- Revoked bool
- True if the token is revoked.
- Rotation
Configuration Pulumi.Git Lab. Inputs. Group Access Token Rotation Configuration - The configuration for when to rotate a token automatically. Will not rotate a token until
pulumi up
is run. - Scopes List<string>
- The scopes of the group access token. Valid values are:
api
,read_api
,read_registry
,write_registry
,read_repository
,write_repository
,create_runner
,manage_runner
,ai_features
,k8s_proxy
,read_observability
,write_observability
- Token string
- The token of the group access token. Note: the token 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:
no one
,minimal
,guest
,reporter
,developer
,maintainer
,owner
. Default ismaintainer
. - Active bool
- True if the token is active.
- Created
At string - Time the token has been created, RFC3339 format.
- Expires
At string - When the token will expire, YYYY-MM-DD format.
- Group string
- The ID or full path of the group.
- Name string
- The name of the group access token.
- Revoked bool
- True if the token is revoked.
- Rotation
Configuration GroupAccess Token Rotation Configuration Args - The configuration for when to rotate a token automatically. Will not rotate a token until
pulumi up
is run. - Scopes []string
- The scopes of the group access token. Valid values are:
api
,read_api
,read_registry
,write_registry
,read_repository
,write_repository
,create_runner
,manage_runner
,ai_features
,k8s_proxy
,read_observability
,write_observability
- Token string
- The token of the group access token. Note: the token 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:
no one
,minimal
,guest
,reporter
,developer
,maintainer
,owner
. Default ismaintainer
. - active Boolean
- True if the token is active.
- created
At String - Time the token has been created, RFC3339 format.
- expires
At String - When the token will expire, YYYY-MM-DD format.
- group String
- The ID or full path of the group.
- name String
- The name of the group access token.
- revoked Boolean
- True if the token is revoked.
- rotation
Configuration GroupAccess Token Rotation Configuration - The configuration for when to rotate a token automatically. Will not rotate a token until
pulumi up
is run. - scopes List<String>
- The scopes of the group access token. Valid values are:
api
,read_api
,read_registry
,write_registry
,read_repository
,write_repository
,create_runner
,manage_runner
,ai_features
,k8s_proxy
,read_observability
,write_observability
- token String
- The token of the group access token. Note: the token 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:
no one
,minimal
,guest
,reporter
,developer
,maintainer
,owner
. Default ismaintainer
. - active boolean
- True if the token is active.
- created
At string - Time the token has been created, RFC3339 format.
- expires
At string - When the token will expire, YYYY-MM-DD format.
- group string
- The ID or full path of the group.
- name string
- The name of the group access token.
- revoked boolean
- True if the token is revoked.
- rotation
Configuration GroupAccess Token Rotation Configuration - The configuration for when to rotate a token automatically. Will not rotate a token until
pulumi up
is run. - scopes string[]
- The scopes of the group access token. Valid values are:
api
,read_api
,read_registry
,write_registry
,read_repository
,write_repository
,create_runner
,manage_runner
,ai_features
,k8s_proxy
,read_observability
,write_observability
- token string
- The token of the group access token. Note: the token 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:
no one
,minimal
,guest
,reporter
,developer
,maintainer
,owner
. Default ismaintainer
. - active bool
- True if the token is active.
- created_
at str - Time the token has been created, RFC3339 format.
- expires_
at str - When the token will expire, YYYY-MM-DD format.
- group str
- The ID or full path of the group.
- name str
- The name of the group access token.
- revoked bool
- True if the token is revoked.
- rotation_
configuration GroupAccess Token Rotation Configuration Args - The configuration for when to rotate a token automatically. Will not rotate a token until
pulumi up
is run. - scopes Sequence[str]
- The scopes of the group access token. Valid values are:
api
,read_api
,read_registry
,write_registry
,read_repository
,write_repository
,create_runner
,manage_runner
,ai_features
,k8s_proxy
,read_observability
,write_observability
- token str
- The token of the group access token. Note: the token 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:
no one
,minimal
,guest
,reporter
,developer
,maintainer
,owner
. Default ismaintainer
. - active Boolean
- True if the token is active.
- created
At String - Time the token has been created, RFC3339 format.
- expires
At String - When the token will expire, YYYY-MM-DD format.
- group String
- The ID or full path of the group.
- name String
- The name of the group access token.
- revoked Boolean
- True if the token is revoked.
- rotation
Configuration Property Map - The configuration for when to rotate a token automatically. Will not rotate a token until
pulumi up
is run. - scopes List<String>
- The scopes of the group access token. Valid values are:
api
,read_api
,read_registry
,write_registry
,read_repository
,write_repository
,create_runner
,manage_runner
,ai_features
,k8s_proxy
,read_observability
,write_observability
- token String
- The token of the group access token. Note: the token is not available for imported resources.
- user
Id Number - The user_id associated to the token.
Supporting Types
GroupAccessTokenRotationConfiguration, GroupAccessTokenRotationConfigurationArgs
- Expiration
Days int - The duration (in days) the new token should be valid for.
- Rotate
Before intDays - The duration (in days) before the expiration when the token should be rotated. As an example, if set to 7 days, the token will rotate 7 days before the expiration date, but only when
pulumi up
is run in that timeframe.
- Expiration
Days int - The duration (in days) the new token should be valid for.
- Rotate
Before intDays - The duration (in days) before the expiration when the token should be rotated. As an example, if set to 7 days, the token will rotate 7 days before the expiration date, but only when
pulumi up
is run in that timeframe.
- expiration
Days Integer - The duration (in days) the new token should be valid for.
- rotate
Before IntegerDays - The duration (in days) before the expiration when the token should be rotated. As an example, if set to 7 days, the token will rotate 7 days before the expiration date, but only when
pulumi up
is run in that timeframe.
- expiration
Days number - The duration (in days) the new token should be valid for.
- rotate
Before numberDays - The duration (in days) before the expiration when the token should be rotated. As an example, if set to 7 days, the token will rotate 7 days before the expiration date, but only when
pulumi up
is run in that timeframe.
- expiration_
days int - The duration (in days) the new token should be valid for.
- rotate_
before_ intdays - The duration (in days) before the expiration when the token should be rotated. As an example, if set to 7 days, the token will rotate 7 days before the expiration date, but only when
pulumi up
is run in that timeframe.
- expiration
Days Number - The duration (in days) the new token should be valid for.
- rotate
Before NumberDays - The duration (in days) before the expiration when the token should be rotated. As an example, if set to 7 days, the token will rotate 7 days before the expiration date, but only when
pulumi up
is run in that timeframe.
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.