jfrog / terraform-provider-artifactory

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

'content_synchronisation' is updated every time #13

Closed spuder closed 3 years ago

spuder commented 3 years ago

Terraform 0.13.0 Module 2.2.4 Artifactory 6.23

When importing a remote resource from artifactory, it wants to set a value named content_synchronisation, but that does not appear to be a valid resource parameter

resource "artifactory_remote_repository" "conan-remote" {
  key = "conan-remote"
  package_type = "conan"
  url = "https://conan.bintray.com"
  repo_layout_ref = "conan-default"
  notes = "managed by terraform"
}

terraform import artifactory_remote_repository.conan-remote conan-remote

terraform apply

 # artifactory_remote_repository.conan-remote will be updated in-place
  ~ resource "artifactory_remote_repository" "conan-remote" {
        allow_any_host_auth                   = false
        blacked_out                           = false
        block_mismatching_mime_types          = true
        bypass_head_requests                  = false
        enable_cookie_management              = false
        enable_token_authentication           = false
        fetch_jars_eagerly                    = false
        fetch_sources_eagerly                 = false
        force_nuget_authentication            = false
        handle_releases                       = true
        handle_snapshots                      = true
        hard_fail                             = false
        id                                    = "conan-remote"
        includes_pattern                      = "**/*"
        key                                   = "conan-remote"
        max_unique_snapshots                  = 0
        missed_cache_period_seconds           = 1800
      + notes                                 = "managed by terraform"
        offline                               = false
        package_type                          = "conan"
        property_sets                         = []
        remote_repo_checksum_policy_type      = "generate-if-absent"
        repo_layout_ref                       = "conan-default"
        retrieval_cache_period_seconds        = 600
        share_configuration                   = false
        socket_timeout_millis                 = 15000
        store_artifacts_locally               = true
        suppress_pom_consistency_checks       = true
        synchronize_properties                = false
        unused_artifacts_cleanup_period_hours = 0
        url                                   = "https://conan.bintray.com"
        xray_index                            = false

      - content_synchronisation {               <------------ What should this resource be set to? 
          - enabled = false -> null
        }
    }

https://registry.terraform.io/providers/jfrog/artifactory/latest/docs/resources/artifactory_remote_repository#synchronize_properties

spuder commented 3 years ago

Workaround is to set this on every resource

resource "artifactory_remote_repository" "docker-remote" {
  key             = "docker-remote"
  package_type    = "docker"
  repo_layout_ref = "simple-default"
  url             = "https://registry-1.docker.io/"
  notes           = "managed by terraform"
  content_synchronisation {
    enabled = null
  }
}
hammopau commented 3 years ago

FYI - I hit issues with setting to 'null', but using 'false' works cleanly.

chb0github commented 3 years ago

I am unable to recreate this issue - and, more importantly: is it an issue? Or, is it just not what you expected?

spuder commented 3 years ago

Ran into this again today. If we omit content_synchronization then we are unable to import any manually created resources from artifactory into terraform.

If we include content_synchronization the first time a resources is created with TF, then it fails with rpc transport is closing.

So we are stuck in this very tricky pattern where we have to omit content_synchronization on the very first terraform apply, but then we have to add it in for the second terraform apply, unless we are importing a resource.

chb0github commented 3 years ago

Ok, thanks. Let me dig into this. Not sure How much priority I can give this - if you're a paying customer, filing a support ticket will light a fire thought :)

chb0github commented 3 years ago

@spuder - Can you clarify with me what behavior you would like to see? And, I simply can't repo it - so, I need something (ideally) copy-and-pastable.