Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using country + georegions on regions leads to dirty plans #323

Open
JanBerktold opened this issue Jul 15, 2024 · 1 comment · May be fixed by #337
Open

Using country + georegions on regions leads to dirty plans #323

JanBerktold opened this issue Jul 15, 2024 · 1 comment · May be fixed by #337
Assignees

Comments

@JanBerktold
Copy link
Contributor

Hi there,

When using a region within a record on the latest versions, we are seeing dirty plans caused by re-ordering of the country/georegions (see below). This persists across plan/apply cycles.

      - regions {
          - meta = {
              - "country"   = "RU,CA,MX,US"
              - "georegion" = "EUROPE,US-CENTRAL,US-WEST,AFRICA,US-EAST"
            } -> null
          - name = "NA-EMEA" -> null
        }
      + regions {
          + meta = {
              + "country"   = "CA,MX,RU,US"
              + "georegion" = "AFRICA,EUROPE,US-CENTRAL,US-EAST,US-WEST"
            }
          + name = "NA-EMEA"
        }

Terraform Version

on darwin_arm64
+ provider registry.terraform.io/hashicorp/aws v5.58.0
+ provider registry.terraform.io/hashicorp/http v3.4.3
+ provider registry.terraform.io/ns1-terraform/ns1 v2.3.1

Affected Resource(s)

  • resource_record

Debug Output

Please provider a link to a GitHub Gist containing the complete debug output: https://www.terraform.io/docs/internals/debugging.html. Please do NOT paste the debug output in the issue; just paste a link to the Gist.

Panic Output

If Terraform produced a panic, please provide a link to a GitHub Gist containing the output of the crash.log.

Expected Behavior

There should not by any changes.

@fformica
Copy link
Contributor

fformica commented Dec 3, 2024

It's a bit of a pickle, because the default hashing in a TF set is not order-invariant, but even if we use a different hashing function when building it we can't seem to get it to stick in the plan.
One thing to note is that at the moment we're sorting these fields when building the meta object, but the flow from PlanResourceChange builds them in a different way that doesn't sort them, which is why we end up with a difference: we could remove the sorting, but that's in ns1-go and it's fine in other places.
I'm not despairing of finding a fix but I don't expect it to be easy.

Workaround for now: keeps these fields sorted in the terraform file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants