Creating groups fials with "Error: POST https://gitlab.com/api/v4/groups: 403 {message: 403 Forbidden}"

Bug Report

I have the following code

resource "gitlab_group" "infrastructure-modules" {
  name                               = "infrastructure-modules"
  description                        = "Public shared modules for infrastructure (terraform modules, ansible roles, ...)"
  ...
}

While plan is ok, the apply fails with

Error: POST https://gitlab.com/api/v4/groups: 403 {message: 403 Forbidden}
with module.gitlab.gitlab_group.infrastructure-modules
on gitlab/infrastructure-modules.tf line 1, in resource "gitlab_group" "infrastructure-modules":

resource "gitlab_group" "infrastructure-modules" {

The run happens via terraform cloud and the used token has the following permissions and is still valid:

  • api, read_api, read_user, self_rotate, read_repository, write_repository, read_registry, write_registry
  • used: 3 minutes ago
  • expires: in 9 months

Relevant Terraform Configuration

resource "gitlab_group" "infrastructure-modules" {
  name                               = "infrastructure-modules"
  description                        = "Public shared modules for infrastructure (terraform modules, ansible roles, ...)"
  auto_devops_enabled                = false
  default_branch_protection          = 2
  emails_enabled                     = false
  extra_shared_runners_minutes_limit = 0
  ip_restriction_ranges              = []
  lfs_enabled                        = true
  membership_lock                    = false
  mentions_disabled                  = false
  path                               = "infrastructure-modules"
  prevent_forking_outside_group      = false
  project_creation_level             = "developer"
  request_access_enabled             = false
  require_two_factor_authentication  = true
  share_with_group_lock              = true
  shared_runners_minutes_limit       = 0
  subgroup_creation_level            = "owner"
  two_factor_grace_period            = 4
  visibility_level                   = "public"
  wiki_access_level                  = "enabled"
}

Relevant Terraform Command

terraform apply

Relevant Log Output

These are the debug logs of the `terraform` command output:

Additional Details

  • GitLab Terraform Provider Version: v17.8.0
  • GitLab Instance Version: github.com
  • Terraform Version: v1.11.4
Edited by Adrian Wyssmann