terraform-provider-kops icon indicating copy to clipboard operation
terraform-provider-kops copied to clipboard

Sort external policies

Open argoyle opened this issue 2 years ago • 5 comments

Would it be possible to sort the external policies in the state to make those kinds of changes go away?

  # module.k8s.kops_cluster.k8s will be updated in-place
  ~ resource "kops_cluster" "k8s" {
        id                       = "k8s.xxx.yy"
        name                     = "k8s.xxx.yy"
      ~ revision                 = 37 -> 38
        # (22 unchanged attributes hidden)

      ~ external_policies {
          ~ key   = "node" -> "master"
            # (1 unchanged attribute hidden)
        }
      ~ external_policies {
          ~ key   = "master" -> "node"
            # (1 unchanged attribute hidden)
        }

        # (22 unchanged blocks hidden)
    }

argoyle avatar Oct 04 '22 11:10 argoyle

I guess it changed in the config ?

eddycharly avatar Oct 04 '22 12:10 eddycharly

@argoyle does the diff happens when the input config is identical ?

eddycharly avatar Oct 04 '22 12:10 eddycharly

It's not always changing and trigger an update, that's why I think it might be due to Go's handling of maps and non-deterministic order when ranging over them.

argoyle avatar Oct 04 '22 12:10 argoyle

So you confirm the input terraform config did not change ? I will give a look, could be because of go maps indeed.

eddycharly avatar Oct 04 '22 13:10 eddycharly

I haven't changed anything related to external policies. It might be other changes that trigger the actual update though. This time it was due to updating to 1.25.1 of the provider only, no other changes.

argoyle avatar Oct 04 '22 14:10 argoyle