UserImpersonationToken

class UserImpersonationToken : KotlinCustomResource

The gitlab.UserImpersonationToken resource allows to manage impersonation tokens of users. Requires administrator access. Token values are returned once. You are only able to create impersonation tokens to impersonate the user and perform both API calls and Git reads and writes. The user can’t see these tokens in their profile settings page. Upstream API: GitLab REST API docs

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as gitlab from "@pulumi/gitlab";
const _this = new gitlab.UserImpersonationToken("this", {
userId: 12345,
name: "token_name",
scopes: ["api"],
expiresAt: "2024-08-27",
});
import pulumi
import pulumi_gitlab as gitlab
this = gitlab.UserImpersonationToken("this",
user_id=12345,
name="token_name",
scopes=["api"],
expires_at="2024-08-27")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using GitLab = Pulumi.GitLab;
return await Deployment.RunAsync(() =>
{
var @this = new GitLab.UserImpersonationToken("this", new()
{
UserId = 12345,
Name = "token_name",
Scopes = new[]
{
"api",
},
ExpiresAt = "2024-08-27",
});
});
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.NewUserImpersonationToken(ctx, "this", &gitlab.UserImpersonationTokenArgs{
UserId: pulumi.Int(12345),
Name: pulumi.String("token_name"),
Scopes: pulumi.StringArray{
pulumi.String("api"),
},
ExpiresAt: pulumi.String("2024-08-27"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gitlab.UserImpersonationToken;
import com.pulumi.gitlab.UserImpersonationTokenArgs;
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 this_ = new UserImpersonationToken("this", UserImpersonationTokenArgs.builder()
.userId(12345)
.name("token_name")
.scopes("api")
.expiresAt("2024-08-27")
.build());
}
}
resources:
this:
type: gitlab:UserImpersonationToken
properties:
userId: 12345
name: token_name
scopes:
- api
expiresAt: 2024-08-27

Import

Starting in Terraform v1.5.0 you can use an import block to import gitlab_user_impersonation_token. For example: terraform import { to = gitlab_user_impersonation_token.example id = "see CLI command below for ID" } Import using the CLI is supported using the following syntax: A GitLab User Impersonation Token can be imported using a key composed of <user-id>:<token-id>, e.g.

$ pulumi import gitlab:index/userImpersonationToken:UserImpersonationToken example "12345:1"

NOTE: the token resource attribute is not available for imported resources as this information cannot be read from the GitLab API.

Properties

Link copied to clipboard
val active: Output<Boolean>

True if the token is active.

Link copied to clipboard
val createdAt: Output<String>

Time the token has been created, RFC3339 format.

Link copied to clipboard
val expiresAt: Output<String>

Expiration date of the impersonation token in ISO format (YYYY-MM-DD).

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val impersonation: Output<Boolean>

True as the token is always an impersonation token.

Link copied to clipboard
val name: Output<String>

The name of the impersonation token.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val revoked: Output<Boolean>

True if the token is revoked.

Link copied to clipboard
val scopes: Output<List<String>>

Array of scopes of the impersonation token. valid values are: api, read_user, read_api, read_repository, write_repository, read_registry, write_registry, sudo, admin_mode, create_runner, manage_runner, ai_features, k8s_proxy, read_service_ping

Link copied to clipboard
val token: Output<String>

The token of the user impersonation token. Note: the token is not available for imported resources.

Link copied to clipboard
val tokenId: Output<Int>

ID of the impersonation token.

Link copied to clipboard
val urn: Output<String>
Link copied to clipboard
val userId: Output<Int>

The ID of the user.