jfrog / terraform-provider-artifactory

Terraform provider to manage JFrog Artifactory
https://jfrog.com/artifactory
Apache License 2.0
276 stars 106 forks source link

repository_layout's import doesn't import state properly #610

Closed klemmster closed 1 year ago

klemmster commented 1 year ago

After importing an existing repository layout, when running terraform plan I get the following output:

  # artifactory_repository_layout.this["maven-2-default"] must be replaced
-/+ resource "artifactory_repository_layout" "this" {
      + artifact_path_pattern               = "[orgPath]/[module]/[baseRev](-[folderItegRev])/[module]-[baseRev](-[fileItegRev])(-[classifier]).[ext]"
      + descriptor_path_pattern             = "[orgPath]/[module]/[baseRev](-[folderItegRev])/[module]-[baseRev](-[fileItegRev])(-[classifier]).[ext]"
      + distinctive_descriptor_path_pattern = true
      + file_integration_revision_regexp    = ".*"
      + folder_integration_revision_regexp  = ".*"
      ~ id                                  = "maven-2-default" -> (known after apply)
      + name                                = "maven-2-default" # forces replacement
    }

I'd expect the name field to be "unchanged", not causing a replacement. If the current config matches the artifactory state, no planned changes should be shown. All the other attributes should show either "changed/unchanged" instead of "add", although this is likely caused by the "replacement". The current behavior makes it a rather scary import action, since terraform plan will show replacements for all repository layouts, even if the terraform defintion matches the state of the artifactory.

I'd appreciate if that could be fixed in the near future.

Terraform v1.3.6
+ provider registry.terraform.io/jfrog/artifactory v6.21.8
jf rt curl api/system/version
{
  "version" : "7.33.12",
alexhung commented 1 year ago

@klemmster I find the cause and am working on the fix. FYI, due to holiday schedule and vacation times, I won't be able to get this release until Jan next year.

klemmster commented 1 year ago

Thank you for looking into it that quickly. Great to hear a fix is already in the making. Enjoy the holiday season :)

klemmster commented 1 year ago

@alexhung Thank you for fixing it. Works like a charm now :)