Skip to content

dhoppeIT/terraform-gitlab-personal_access_token

Repository files navigation

terraform-gitlab-personal_access_token

Terraform module to manage the following Twingate resources:

  • gitlab_personal_access_token

Usage

Copy and paste the following code snippet to your Terraform configuration, specify the required variables and run the command terraform init.

module "gitlab_user" {
  source  = "gitlab.com/terraform-child-modules-48151/terraform-gitlab-user/local"
  version = "1.2.0"

  name     = "John Doe"
  username = "jdoe"
  password = "XKvhCJp9MtwTgwRu" # gitleaks:allow
  email    = "john.doe@example.com"
}

module "gitlab_personal_access_token" {
  source  = "gitlab.com/terraform-child-modules-48151/terraform-gitlab-personal-access-token/local"
  version = "1.0.0"

  name    = "example-access-token"
  scopes  = ["read_api"]
  user_id = module.gitlab_user.id

  rotation_configuration = {
    expiration_days    = 365
    rotate_before_days = 7
  }
}

⚠️ This feature requires a Premium / Ultimate license or self-managed instance.

Requirements

Name Version
terraform >= 1.0
gitlab ~> 18.0

Providers

Name Version
gitlab ~> 18.0

Modules

No modules.

Resources

Name Type
gitlab_personal_access_token.this resource

Inputs

Name Description Type Default Required
description The description of the personal access token string null no
expires_at When the token will expire, YYYY-MM-DD format string null no
name The name of the personal access token string n/a yes
rotation_configuration The configuration for when to rotate a token automatically object( { expiration_days = optional(number) rotate_before_days = optional(number) } ) {} no
scopes The scopes of the personal access token list(string) n/a yes
user_id The ID of the user string n/a yes
validate_past_expiration_date Wether to validate if the expiration date is in the future bool null no

Outputs

Name Description
active True if the token is active
created_at Time the token has been created, RFC3339 format
id The ID of the personal access token
revoked True if the token is revoked
token The token of the personal access token

Authors

Created and maintained by Dennis Hoppe.

License

Apache 2 licensed. See LICENSE for full details.