Skip to content

Add rotation_configuration for gitlab_group_service_account_access_token resource

Hello 👋

Maybe I missed something but at this time it is not possible to provide the rotation_configuration block for gitlab_group_service_account_access_token resource.

I'm looking for something that I could use like this:

resource "gitlab_group" "example" {
  name        = "example"
  path        = "example"
  description = "An example group"
}

resource "gitlab_group_service_account" "example-sa" {
  group    = gitlab_group.example.id
  name     = "example-name"
  username = "example-username"
}

resource "gitlab_group_service_account_access_token" "example-sa-token" {
  group      = gitlab_group.example.id
  user_id    = gitlab_group_service_account.example-sa.id
  name       = "Example personal access token"

  scopes = ["api"]

  rotation_configuration = {
    expiration_days = 7
    rotate_before_days = 3
  }
}

Related GitLab APIs

https://docs.gitlab.com/ee/api/group_service_accounts.html#rotate-a-personal-access-token-for-a-service-account-user

Additional Details