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

DiffSupressFunc on TypeLists operates on the {foo}.# marker value. #743

Open
toumorokoshi opened this issue Apr 16, 2021 · 1 comment
Open
Labels
bug Something isn't working

Comments

@toumorokoshi
Copy link

SDK version

2.5.0 (but looks to exist in head as of this issue creation)

Relevant provider source code

See https://github.com/hashicorp/terraform-provider-google/blob/master/google/resource_dns_resource_dns_record_set.go#L91.

Terraform Configuration Files

resource "google_dns_record_set" "resource-recordset" {
  managed_zone = google_dns_managed_zone.parent-zone.name
  name         = "test-record.my-zone.hashicorptest.com."
  type         = "AAAA"
  rrdatas = [
      "7777:7777:7777:7777::",
      "8888:8888:8888:8888::",
  ]
  ttl          = 86400
}

Debug Output

out of plan:

  # google_dns_record_set.resource-recordset will be created
  + resource "google_dns_record_set" "resource-recordset" {
      + id           = (known after apply)
      + managed_zone = "my-zone"
      + name         = "test-record.my-zone.hashicorptest.com."
      + project      = (known after apply)
      + rrdatas      = []
      + ttl          = 86400
      + type         = "AAAA"
    }

Expected Behavior

rrdatas has the list of values added in the schema.

Actual Behavior

A bug is already filed with the provider, but a DiffSuppressFunc which was applied to a TypeList attribute resulted in also operating on the {fieldname}.# marker value used to determine the length of the field. In this case, the DiffSuppressFunc outputted that the diff for that field should be suppressed, effectively eliminating that value in the final diffAttributes.

That marker value for the length is also used to determine the existence of the value at all. So the result is that the whole TypeList value is missing.

I think the right fix would be only running DiffSuppressFunc on the individual elements, rather than the marker {fieldname}.# value.

Steps to Reproduce

See hashicorp/terraform-provider-google#8935.

References

@melinath
Copy link

I recently ran into this as well - specifically the part where suppressing a diff on the # field causes the entire value to be seen as empty when applying the plan, even if there are unsuppressed diffs in the actual values for the fields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants