Skip to content

Project label creation fails when the project already has a number of labels

Created by: flelli

Terraform Version

$ terraform -v
Terraform v0.12.9
+ provider.gitlab v2.3.0

Affected Resource(s)

  • gitlab_label

Terraform Configuration Files

Within a module:

resource "gitlab_label" "label" {
  for_each                  = var.labels
  name                      = each.key
  description               = each.value.description
  project                   = var.project_id
  color                     = "#${each.value.color}"
}

Expected Behavior

Labels should have been created and retained in Terraform state.

Actual Behavior

When applying, this error is raised:

Error: Provider produced inconsistent result after apply

When applying changes to
module.GTL-PROJECT-INFRASTRUCTURE.gitlab_label.label["VPN"], provider "gitlab"
produced an unexpected new value for was present, but now absent.

This is a bug in the provider, which should be reported in the provider's own
issue tracker.

The label is created on GitLab but not retained in Terraform state so any further apply raises other errors because the resource already exists.

This issue only appears on projects with a consistent number of labels. If some existing labels are destroyed then a few more can be created.

Steps to Reproduce

  1. create a sufficient number of project labels (>15 or 20)
  2. terraform apply

Important Factoids

The project also has group labels, but that doesn't seem to be relevant.