atlassian / terraform-provider-artifactory

Terraform provider to manage Artifactory
Apache License 2.0
89 stars 42 forks source link

Lifecycle ignore_changes for password is not ignored and breaks the replication password resulting in the 401 Unauthorized #94

Open MyKEms opened 4 years ago

MyKEms commented 4 years ago

Community Note

Terraform Version

Affected Resource(s)

Terraform Configuration Files

resource "artifactory_replication_config" "npm-test" {
  repo_key                 = artifactory_local_repository.npm-test.key
  cron_exp                 = "0 0 6,23 ? * * *"
  enable_event_replication = false

  replications {
    enabled               = true
    socket_timeout_millis = 15000
    sync_deletes          = true
    sync_properties       = true
    sync_statistics       = true
    url                   = "https://art-instance.com/artifactory/npm-test/"
    username              = "username"
  }

  lifecycle {
    ignore_changes = [
      replications.0.password
    ]
  }

}

Debug Output

Gist link

Panic Output

Expected Behavior

  lifecycle {
    ignore_changes = [
      replications.0.password
    ]
  }

Actual Behavior

  lifecycle {
    ignore_changes = [
      replications.0.password
    ]
  }
# artifactory_replication_config.npm-test will be updated in-place
  ~ resource "artifactory_replication_config" "npm-test" {
        cron_exp                 = "0 0 6,23 ? * * *"
        enable_event_replication = false
        id                       = "npm-test"
        repo_key                 = "npm-test"

      ~ replications {
          ~ enabled               = false -> true
            password              = (sensitive value)
            socket_timeout_millis = 15000
            sync_deletes          = true
            sync_properties       = true
            sync_statistics       = true
            url                   = "https://art-instance.com/artifactory/npm-test/"
            username              = "username"
        }
    }

Steps to Reproduce

  1. Define artifactory_local_repository + artifactory_replication_config with the ignore_changes for the password.
  2. terraform apply
  3. Check the replication settings in the artifactory and hit the test button - you will receive 401: Unauthorized

Important Factoids

References

peters95 commented 3 years ago

Migrated -> https://github.com/jfrog/terraform-provider-artifactory/issues/20

chb0github commented 3 years ago

I have updated the new ticket and this one can be closed @MyKEms