jfrog/terraform-provider-artifactory

nuget repository project_key is required

Closed this issue · 2 comments

For local, remote, or virtual NuGet repositories project_key is documented optional. I didn't provide it, and an initial apply worked great. The resultant created repository initialized with a project_key value of default. The next time I terraform plan, however, it wants to set it to null

for example:

  # artifactory_virtual_nuget_repository.my_feed will be updated in-place
  ~ resource "artifactory_virtual_nuget_repository" "my_feed" {
        id                                                 = "my-feed"
      - project_key                                        = "default" -> null
        # (9 unchanged attributes hidden)
    }

This can sometimes happen when working with terraform and can resolve with a "double-tap", i.e. apply a second time and things sort themselves out. I tried that, but it ends up 400ing the API call. The problem persists across retries.

The expected behavior is that there would be no pending change. Alternately, make project_key a required terraform variable.

Workaround

I set project_key = "default" in my .tf whenever creating repositories

Versions

  • terraform 1.6 with artifactory provider 10.0.2

@chris-peterson You did not include the version of Artifactory you are running but from the issue description, my guess is >7.49.x and <7.67.x?

This issue with project_key = "default" was introduced last year in Artifactory 7.50.x and fixed in 7.67.x.

We released provider v7.x to deal with this bug and v9.x to revert this behavior when Artifactory bug fix was released.

If you wish to use the latest provider version until your Artifactory is upgraded to >=7.67.x, you can use the Terraform meta-argument lifecycle.ignore_changes for project_key attribute.

You are correct -- we are on 7.59.12 rev 75912900. I will make a note to revert my workaround once we upgrade to a newer version.

Thanks!