argoproj-labs/terraform-provider-argocd

Feature request: Improved diffs

cpboyd opened this issue · 1 comments

Description

Currently, it seems like any time certain blocks are added/removed (e.g. destination {} on argocd_project) then it lists all blocks as being removed and re-added.

With ArgoCD projects that have several destinations specified, this makes it very difficult to track what the actual changes are:

          - destination {
              - namespace = "api" -> null
              - server    = "https://server-1" -> null
            }
          - destination {
              - namespace = "api" -> null
              - server    = "https://server-2" -> null
            }
          - destination {
              - namespace = "api" -> null
              - server    = "https://server-3" -> null
            }
          - destination {
              - namespace = "api" -> null
              - server    = "https://server-4" -> null
            }
          - destination {
              - namespace = "argo-*" -> null
              - server    = "https://server-1" -> null
            }
          - destination {
              - namespace = "argo-*" -> null
              - server    = "https://server-2" -> null
            }
          - destination {
              - namespace = "argo-*" -> null
              - server    = "https://server-3" -> null
            }
          - destination {
              - namespace = "argo-*" -> null
              - server    = "https://server-4" -> null
            }
          - destination {
              - namespace = "pub" -> null
              - server    = "https://server-1" -> null
            }
          - destination {
              - namespace = "pub" -> null
              - server    = "https://server-2" -> null
            }
          - destination {
              - namespace = "pub" -> null
              - server    = "https://server-3" -> null
            }
          - destination {
              - namespace = "pub" -> null
              - server    = "https://server-4" -> null
            }
          - destination {
              - namespace = "sec" -> null
              - server    = "https://server-2" -> null
            }
          - destination {
              - namespace = "sec" -> null
              - server    = "https://server-3" -> null
            }
          - destination {
              - namespace = "sec" -> null
              - server    = "https://server-4" -> null
            }
          - destination {
              - namespace = "test" -> null
              - server    = "https://server-1" -> null
            }
          - destination {
              - namespace = "test" -> null
              - server    = "https://server-2" -> null
            }
          - destination {
              - namespace = "test" -> null
              - server    = "https://server-3" -> null
            }
          - destination {
              - namespace = "test" -> null
              - server    = "https://server-4" -> null
            }
          - destination {
              - namespace = "test" -> null
              - server    = "https://kubernetes.default.svc" -> null
            }
          - destination {
              - namespace = "ui" -> null
              - server    = "https://server-1" -> null
            }
          - destination {
              - namespace = "ui" -> null
              - server    = "https://server-2" -> null
            }
          - destination {
              - namespace = "ui" -> null
              - server    = "https://server-3" -> null
            }
          - destination {
              - namespace = "ui" -> null
              - server    = "https://server-4" -> null
            }
          - destination {
              - namespace = "sec" -> null
              - server    = "https://server-1" -> null
            }
          + destination {
              + namespace = "map"
              + server    = "https://server-1"
            }
          + destination {
              + namespace = "map"
              + server    = "https://server-2"
            }
          + destination {
              + namespace = "map"
              + server    = "https://server-3"
            }
          + destination {
              + namespace = "map"
              + server    = "https://server-4"
            }
          + destination {
              + namespace = "api"
              + server    = "https://server-1"
            }
          + destination {
              + namespace = "api"
              + server    = "https://server-2"
            }
          + destination {
              + namespace = "api"
              + server    = "https://server-3"
            }
          + destination {
              + namespace = "api"
              + server    = "https://server-4"
            }
          + destination {
              + namespace = "argo-*"
              + server    = "https://server-1"
            }
          + destination {
              + namespace = "argo-*"
              + server    = "https://server-2"
            }
          + destination {
              + namespace = "argo-*"
              + server    = "https://server-3"
            }
          + destination {
              + namespace = "argo-*"
              + server    = "https://server-4"
            }
          + destination {
              + namespace = "pub"
              + server    = "https://server-1"
            }
          + destination {
              + namespace = "pub"
              + server    = "https://server-2"
            }
          + destination {
              + namespace = "pub"
              + server    = "https://server-3"
            }
          + destination {
              + namespace = "pub"
              + server    = "https://server-4"
            }
          + destination {
              + namespace = "sec"
              + server    = "https://server-1"
            }
          + destination {
              + namespace = "sec"
              + server    = "https://server-2"
            }
          + destination {
              + namespace = "sec"
              + server    = "https://server-3"
            }
          + destination {
              + namespace = "sec"
              + server    = "https://server-4"
            }
          + destination {
              + namespace = "test"
              + server    = "https://server-1"
            }
          + destination {
              + namespace = "test"
              + server    = "https://server-2"
            }
          + destination {
              + namespace = "test"
              + server    = "https://server-3"
            }
          + destination {
              + namespace = "test"
              + server    = "https://server-4"
            }
          + destination {
              + namespace = "test"
              + server    = "https://kubernetes.default.svc"
            }
          + destination {
              + namespace = "ui"
              + server    = "https://server-1"
            }
          + destination {
              + namespace = "ui"
              + server    = "https://server-2"
            }
          + destination {
              + namespace = "ui"
              + server    = "https://server-3"
            }
          + destination {
              + namespace = "ui"
              + server    = "https://server-4"
            }

Potential Terraform Configuration

I know that other modules have changed from list to map for easier diffs. I'm not sure if maybe using blocks (instead of a map or some other structure) for this is causing the issue here.

Maybe there's also something with how the provider is rendering the pending changes that could be adjusted, like putting the new stuff last (since in this specific example, the only addition is the namespace = "map")

References

hashicorp/terraform#21901

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment