terraform-provider-gitlab icon indicating copy to clipboard operation
terraform-provider-gitlab copied to clipboard

`name_regex_delete` always detects changes

Open mtneug opened this issue 3 years ago • 1 comments

GitLab Provider version

v3.17.0

GitLab version

GitLab Enterprise Edition 15.1.2-ee

Terraform version

v1.2.8

Relevant Terraform Configuration

resource "gitlab_project" "test" {
  name                = "test"
  path                = "test"

  container_expiration_policy {
    enabled           = true
    cadence           = "1d"
    keep_n            = 5
    name_regex_keep   = ""
    older_than        = "7d"
    name_regex_delete = "[0-9a-zA-Z]{40}"
  }
}

Relevant log output

No response

Description

name_regex_delete is set correctly, but a second run detects it changed. The GitLab API actually returns this under the name name_regex instead of name_regex_delete, leaving the Go field empty after the deserialization, thus detecting a change.

mtneug avatar Aug 29 '22 18:08 mtneug

hey @mtneug - This looks like it's actually a bug with the upstream library we use for managing the API calls, specifically here: https://github.com/xanzy/go-gitlab/blob/master/projects.go#L165. I haven't tested and confirmed the behavior you note, but it would certainly make sense based on what's coded in the project.

Would you mind creating the bug upstream and link it here? Once the go-gitlab library is updated, our dependabot will update our version and we could look at this with the next bugfix release.

Usually one of us submits the PRs for that library too, so we can keep this issue open as well to track when we need to consume the new version.

RicePatrick avatar Aug 29 '22 19:08 RicePatrick