Skip to content

dhoppeIT/terraform-gitlab-project_access_token

Repository files navigation

terraform-gitlab-project_access_token

Terraform module to manage the following GitLab resources:

  • gitlab_project_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_project_access_token" {
  source  = "gitlab.com/terraform-child-modules-48151/terraform-gitlab-project-access-token/local"
  version = "1.0.0"

  project = "example-group-48165/example-project"
  name    = "example-access-token"
  scopes  = ["read_api"]

  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_project_access_token.this resource

Inputs

Name Description Type Default Required
access_level The access level for the project access token string "maintainer" no
description The description of the project access token string null no
expires_at When the token will expire, YYYY-MM-DD format string null no
name The name of the project access token string n/a yes
project The ID or full path of the project 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 project access token list(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 project access token
revoked True if the token is revoked.
token The token of the project access token
user_id The user_id associated to the token

Authors

Created and maintained by Dennis Hoppe.

License

Apache 2 licensed. See LICENSE for full details.