gitlab_personal_access_token (Resource)

The gitlab_personal_access_token resource allows to manage the lifecycle of a personal access token for a specified user.

Upstream API: GitLab REST API docs

Example Usage

resource "gitlab_personal_access_token" "example" {
  user_id    = "25"
  name       = "Example personal access token"
  expires_at = "2020-03-14"

  scopes = ["api"]
}

resource "gitlab_project_variable" "example" {
  project = gitlab_project.example.id
  key     = "pat"
  value   = gitlab_personal_access_token.example.token
}

Schema

Required

Read-Only

Import

Import is supported using the following syntax:

# A GitLab Personal Access Token can be imported using a key composed of `<user-id>:<token-id>`, e.g.
terraform import gitlab_personal_access_token.example "12345:1"

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