gitlab.GroupDeployToken
Explore with Pulumi AI
The gitlab.GroupDeployToken
resource allows you to manage the lifecycle of deploy tokens on a group.
Upstream API: GitLab REST API docs
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gitlab from "@pulumi/gitlab";
import * as std from "@pulumi/std";
// Example Usage
const example = new gitlab.GroupDeployToken("example", {
group: "example/deploying",
name: "Example group deploy token",
username: "example-username",
expiresAt: "2020-03-14T00:00:00.000Z",
scopes: [
"read_repository",
"read_registry",
],
});
const example_two = new gitlab.GroupDeployToken("example-two", {
group: "12345678",
name: "Example group deploy token expires in 24h",
expiresAt: std.timestamp({}).then(invoke => std.timeadd({
duration: invoke.result,
timestamp: "24h",
})).then(invoke => invoke.result),
scopes: [
"read_repository",
"read_registry",
],
});
import pulumi
import pulumi_gitlab as gitlab
import pulumi_std as std
# Example Usage
example = gitlab.GroupDeployToken("example",
group="example/deploying",
name="Example group deploy token",
username="example-username",
expires_at="2020-03-14T00:00:00.000Z",
scopes=[
"read_repository",
"read_registry",
])
example_two = gitlab.GroupDeployToken("example-two",
group="12345678",
name="Example group deploy token expires in 24h",
expires_at=std.timeadd(duration=std.timestamp().result,
timestamp="24h").result,
scopes=[
"read_repository",
"read_registry",
])
package main
import (
"github.com/pulumi/pulumi-gitlab/sdk/v9/go/gitlab"
"github.com/pulumi/pulumi-std/sdk/go/std"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// Example Usage
_, err := gitlab.NewGroupDeployToken(ctx, "example", &gitlab.GroupDeployTokenArgs{
Group: pulumi.String("example/deploying"),
Name: pulumi.String("Example group deploy token"),
Username: pulumi.String("example-username"),
ExpiresAt: pulumi.String("2020-03-14T00:00:00.000Z"),
Scopes: pulumi.StringArray{
pulumi.String("read_repository"),
pulumi.String("read_registry"),
},
})
if err != nil {
return err
}
invokeTimeadd, err := std.Timeadd(ctx, &std.TimeaddArgs{
Duration: std.Timestamp(ctx, &std.TimestampArgs{}, nil).Result,
Timestamp: "24h",
}, nil)
if err != nil {
return err
}
_, err = gitlab.NewGroupDeployToken(ctx, "example-two", &gitlab.GroupDeployTokenArgs{
Group: pulumi.String("12345678"),
Name: pulumi.String("Example group deploy token expires in 24h"),
ExpiresAt: pulumi.String(invokeTimeadd.Result),
Scopes: pulumi.StringArray{
pulumi.String("read_repository"),
pulumi.String("read_registry"),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using GitLab = Pulumi.GitLab;
using Std = Pulumi.Std;
return await Deployment.RunAsync(() =>
{
// Example Usage
var example = new GitLab.GroupDeployToken("example", new()
{
Group = "example/deploying",
Name = "Example group deploy token",
Username = "example-username",
ExpiresAt = "2020-03-14T00:00:00.000Z",
Scopes = new[]
{
"read_repository",
"read_registry",
},
});
var example_two = new GitLab.GroupDeployToken("example-two", new()
{
Group = "12345678",
Name = "Example group deploy token expires in 24h",
ExpiresAt = Std.Timestamp.Invoke().Apply(invoke => Std.Timeadd.Invoke(new()
{
Duration = invoke.Result,
Timestamp = "24h",
})).Apply(invoke => invoke.Result),
Scopes = new[]
{
"read_repository",
"read_registry",
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gitlab.GroupDeployToken;
import com.pulumi.gitlab.GroupDeployTokenArgs;
import com.pulumi.std.StdFunctions;
import com.pulumi.std.inputs.TimestampArgs;
import com.pulumi.std.inputs.TimeaddArgs;
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) {
// Example Usage
var example = new GroupDeployToken("example", GroupDeployTokenArgs.builder()
.group("example/deploying")
.name("Example group deploy token")
.username("example-username")
.expiresAt("2020-03-14T00:00:00.000Z")
.scopes(
"read_repository",
"read_registry")
.build());
var example_two = new GroupDeployToken("example-two", GroupDeployTokenArgs.builder()
.group("12345678")
.name("Example group deploy token expires in 24h")
.expiresAt(StdFunctions.timeadd(TimeaddArgs.builder()
.duration(StdFunctions.timestamp(TimestampArgs.builder()
.build()).result())
.timestamp("24h")
.build()).result())
.scopes(
"read_repository",
"read_registry")
.build());
}
}
resources:
# Example Usage
example:
type: gitlab:GroupDeployToken
properties:
group: example/deploying
name: Example group deploy token
username: example-username
expiresAt: 2020-03-14T00:00:00.000Z
scopes:
- read_repository
- read_registry
example-two:
type: gitlab:GroupDeployToken
properties:
group: '12345678'
name: Example group deploy token expires in 24h
expiresAt:
fn::invoke:
function: std:timeadd
arguments:
duration:
fn::invoke:
function: std:timestamp
arguments: {}
return: result
timestamp: 24h
return: result
scopes:
- read_repository
- read_registry
Create GroupDeployToken Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new GroupDeployToken(name: string, args: GroupDeployTokenArgs, opts?: CustomResourceOptions);
@overload
def GroupDeployToken(resource_name: str,
args: GroupDeployTokenArgs,
opts: Optional[ResourceOptions] = None)
@overload
def GroupDeployToken(resource_name: str,
opts: Optional[ResourceOptions] = None,
group: Optional[str] = None,
scopes: Optional[Sequence[str]] = None,
expires_at: Optional[str] = None,
name: Optional[str] = None,
username: Optional[str] = None)
func NewGroupDeployToken(ctx *Context, name string, args GroupDeployTokenArgs, opts ...ResourceOption) (*GroupDeployToken, error)
public GroupDeployToken(string name, GroupDeployTokenArgs args, CustomResourceOptions? opts = null)
public GroupDeployToken(String name, GroupDeployTokenArgs args)
public GroupDeployToken(String name, GroupDeployTokenArgs args, CustomResourceOptions options)
type: gitlab:GroupDeployToken
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 GroupDeployTokenArgs
- 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 GroupDeployTokenArgs
- 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 GroupDeployTokenArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args GroupDeployTokenArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args GroupDeployTokenArgs
- 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 groupDeployTokenResource = new GitLab.GroupDeployToken("groupDeployTokenResource", new()
{
Group = "string",
Scopes = new[]
{
"string",
},
ExpiresAt = "string",
Name = "string",
Username = "string",
});
example, err := gitlab.NewGroupDeployToken(ctx, "groupDeployTokenResource", &gitlab.GroupDeployTokenArgs{
Group: pulumi.String("string"),
Scopes: pulumi.StringArray{
pulumi.String("string"),
},
ExpiresAt: pulumi.String("string"),
Name: pulumi.String("string"),
Username: pulumi.String("string"),
})
var groupDeployTokenResource = new GroupDeployToken("groupDeployTokenResource", GroupDeployTokenArgs.builder()
.group("string")
.scopes("string")
.expiresAt("string")
.name("string")
.username("string")
.build());
group_deploy_token_resource = gitlab.GroupDeployToken("groupDeployTokenResource",
group="string",
scopes=["string"],
expires_at="string",
name="string",
username="string")
const groupDeployTokenResource = new gitlab.GroupDeployToken("groupDeployTokenResource", {
group: "string",
scopes: ["string"],
expiresAt: "string",
name: "string",
username: "string",
});
type: gitlab:GroupDeployToken
properties:
expiresAt: string
group: string
name: string
scopes:
- string
username: string
GroupDeployToken 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 GroupDeployToken resource accepts the following input properties:
- Group string
- The Id or full path of the group.
- Scopes List<string>
- The scopes of the group deploy token. Valid values are:
read_repository
,read_registry
,write_registry
,read_virtual_registry
,write_virtual_registry
,read_package_registry
,write_package_registry
- Expires
At string - Time the token expires in RFC3339 format. Not set by default.
- Name string
- A name to describe the deploy token with.
- Username string
- A username for the deploy token. Default is
gitlab+deploy-token-{n}
.
- Group string
- The Id or full path of the group.
- Scopes []string
- The scopes of the group deploy token. Valid values are:
read_repository
,read_registry
,write_registry
,read_virtual_registry
,write_virtual_registry
,read_package_registry
,write_package_registry
- Expires
At string - Time the token expires in RFC3339 format. Not set by default.
- Name string
- A name to describe the deploy token with.
- Username string
- A username for the deploy token. Default is
gitlab+deploy-token-{n}
.
- group String
- The Id or full path of the group.
- scopes List<String>
- The scopes of the group deploy token. Valid values are:
read_repository
,read_registry
,write_registry
,read_virtual_registry
,write_virtual_registry
,read_package_registry
,write_package_registry
- expires
At String - Time the token expires in RFC3339 format. Not set by default.
- name String
- A name to describe the deploy token with.
- username String
- A username for the deploy token. Default is
gitlab+deploy-token-{n}
.
- group string
- The Id or full path of the group.
- scopes string[]
- The scopes of the group deploy token. Valid values are:
read_repository
,read_registry
,write_registry
,read_virtual_registry
,write_virtual_registry
,read_package_registry
,write_package_registry
- expires
At string - Time the token expires in RFC3339 format. Not set by default.
- name string
- A name to describe the deploy token with.
- username string
- A username for the deploy token. Default is
gitlab+deploy-token-{n}
.
- group str
- The Id or full path of the group.
- scopes Sequence[str]
- The scopes of the group deploy token. Valid values are:
read_repository
,read_registry
,write_registry
,read_virtual_registry
,write_virtual_registry
,read_package_registry
,write_package_registry
- expires_
at str - Time the token expires in RFC3339 format. Not set by default.
- name str
- A name to describe the deploy token with.
- username str
- A username for the deploy token. Default is
gitlab+deploy-token-{n}
.
- group String
- The Id or full path of the group.
- scopes List<String>
- The scopes of the group deploy token. Valid values are:
read_repository
,read_registry
,write_registry
,read_virtual_registry
,write_virtual_registry
,read_package_registry
,write_package_registry
- expires
At String - Time the token expires in RFC3339 format. Not set by default.
- name String
- A name to describe the deploy token with.
- username String
- A username for the deploy token. Default is
gitlab+deploy-token-{n}
.
Outputs
All input properties are implicitly available as output properties. Additionally, the GroupDeployToken resource produces the following output properties:
Look up Existing GroupDeployToken Resource
Get an existing GroupDeployToken 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?: GroupDeployTokenState, opts?: CustomResourceOptions): GroupDeployToken
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
expired: Optional[bool] = 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,
username: Optional[str] = None) -> GroupDeployToken
func GetGroupDeployToken(ctx *Context, name string, id IDInput, state *GroupDeployTokenState, opts ...ResourceOption) (*GroupDeployToken, error)
public static GroupDeployToken Get(string name, Input<string> id, GroupDeployTokenState? state, CustomResourceOptions? opts = null)
public static GroupDeployToken get(String name, Output<String> id, GroupDeployTokenState state, CustomResourceOptions options)
resources: _: type: gitlab:GroupDeployToken get: id: ${id}
- 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.
- Expired bool
- True if the token is expired.
- Expires
At string - Time the token expires in RFC3339 format. Not set by default.
- Group string
- The Id or full path of the group.
- Name string
- A name to describe the deploy token with.
- Revoked bool
- True if the token is revoked.
- Scopes List<string>
- The scopes of the group deploy token. Valid values are:
read_repository
,read_registry
,write_registry
,read_virtual_registry
,write_virtual_registry
,read_package_registry
,write_package_registry
- Token string
- The secret token. This is only populated when creating a new deploy token. Note: The token is not available for imported resources.
- Username string
- A username for the deploy token. Default is
gitlab+deploy-token-{n}
.
- Expired bool
- True if the token is expired.
- Expires
At string - Time the token expires in RFC3339 format. Not set by default.
- Group string
- The Id or full path of the group.
- Name string
- A name to describe the deploy token with.
- Revoked bool
- True if the token is revoked.
- Scopes []string
- The scopes of the group deploy token. Valid values are:
read_repository
,read_registry
,write_registry
,read_virtual_registry
,write_virtual_registry
,read_package_registry
,write_package_registry
- Token string
- The secret token. This is only populated when creating a new deploy token. Note: The token is not available for imported resources.
- Username string
- A username for the deploy token. Default is
gitlab+deploy-token-{n}
.
- expired Boolean
- True if the token is expired.
- expires
At String - Time the token expires in RFC3339 format. Not set by default.
- group String
- The Id or full path of the group.
- name String
- A name to describe the deploy token with.
- revoked Boolean
- True if the token is revoked.
- scopes List<String>
- The scopes of the group deploy token. Valid values are:
read_repository
,read_registry
,write_registry
,read_virtual_registry
,write_virtual_registry
,read_package_registry
,write_package_registry
- token String
- The secret token. This is only populated when creating a new deploy token. Note: The token is not available for imported resources.
- username String
- A username for the deploy token. Default is
gitlab+deploy-token-{n}
.
- expired boolean
- True if the token is expired.
- expires
At string - Time the token expires in RFC3339 format. Not set by default.
- group string
- The Id or full path of the group.
- name string
- A name to describe the deploy token with.
- revoked boolean
- True if the token is revoked.
- scopes string[]
- The scopes of the group deploy token. Valid values are:
read_repository
,read_registry
,write_registry
,read_virtual_registry
,write_virtual_registry
,read_package_registry
,write_package_registry
- token string
- The secret token. This is only populated when creating a new deploy token. Note: The token is not available for imported resources.
- username string
- A username for the deploy token. Default is
gitlab+deploy-token-{n}
.
- expired bool
- True if the token is expired.
- expires_
at str - Time the token expires in RFC3339 format. Not set by default.
- group str
- The Id or full path of the group.
- name str
- A name to describe the deploy token with.
- revoked bool
- True if the token is revoked.
- scopes Sequence[str]
- The scopes of the group deploy token. Valid values are:
read_repository
,read_registry
,write_registry
,read_virtual_registry
,write_virtual_registry
,read_package_registry
,write_package_registry
- token str
- The secret token. This is only populated when creating a new deploy token. Note: The token is not available for imported resources.
- username str
- A username for the deploy token. Default is
gitlab+deploy-token-{n}
.
- expired Boolean
- True if the token is expired.
- expires
At String - Time the token expires in RFC3339 format. Not set by default.
- group String
- The Id or full path of the group.
- name String
- A name to describe the deploy token with.
- revoked Boolean
- True if the token is revoked.
- scopes List<String>
- The scopes of the group deploy token. Valid values are:
read_repository
,read_registry
,write_registry
,read_virtual_registry
,write_virtual_registry
,read_package_registry
,write_package_registry
- token String
- The secret token. This is only populated when creating a new deploy token. Note: The token is not available for imported resources.
- username String
- A username for the deploy token. Default is
gitlab+deploy-token-{n}
.
Import
Starting in Terraform v1.5.0, you can use an import block to import gitlab_group_deploy_token
. For example:
terraform
import {
to = gitlab_group_deploy_token.example
id = “see CLI command below for ID”
}
Importing using the CLI is supported with the following syntax:
GitLab group deploy tokens can be imported using an id made up of {group_id}:{deploy_token_id}
.
$ pulumi import gitlab:index/groupDeployToken:GroupDeployToken group_token 1:4
Note: 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.