Skip to content

Not rotating project access token when it should

Not rotating project access token when it should

Bug Report

When trying to test the feature of rotating Gitlab project access tokens, it did not work as intended.

The tokens were set to last 7 and 5 days but should be rotated 6 and 3 days before respectively. However, whether with plan nor with apply it did not rotated.

The output of Terraform command is that nothing has change so impossible to apply.

Relevant Terraform Configuration

resource "gitlab_project_access_token" "first" {
  project      = gitlab_project.main.id
  name         = "Example project access token"
  access_level = "guest"

  scopes = ["read_api"]

  # Rotate the token before it expires
  rotation_configuration = {
    expiration_days    = 7
    rotate_before_days = 6
  }
}

resource "gitlab_project_access_token" "second" {
  project      = gitlab_project.main.id
  name         = "Example project access token"
  access_level = "owner"

  scopes = ["api", "read_api", "k8s_proxy", "read_registry"]

  # Rotate the token before it expires
  rotation_configuration = {
    expiration_days    = 5
    rotate_before_days = 3
  }
}

Relevant Terraform Command

terraform apply

Relevant Log Output

These are the debug logs of the `terraform` command output:
No changes. Your infrastructure matches the configuration.

Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Additional Details

  • GitLab Terraform Provider Version: 16.11.0
  • GitLab Version: GitLab Enterprise Edition 17.0.0-pre
  • Terraform Version: 1.7.4
Edited by Matthieu Segui