-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Terraform 0.12 Set diff shows every field being recreated #21901
Comments
Hi @rileykarson, Looking at the schema for that resource, The referenced issue mentions that the order matters. If that's the case, then the set data type isn't appropriate here and we should migrate Thanks! |
Ordering of elements has no effect. If I replace my second config with the following: resource "google_bigquery_dataset" "temp" {
dataset_id = "temp"
default_table_expiration_ms = "2419200000"
access {
user_by_email = "tf-test-2174102886934250970@graphite-test-rileykarson.iam.gserviceaccount.com"
role = "OWNER"
}
access {
role = "OWNER"
user_by_email = "[email protected]"
}
} I get this plan:
|
Thanks for confirming @rileykarson. The provider shims do some normalization so that the small differences are ironed out when there is no overall change to the resource, but set values can't always be normalized in such a manner, because modifying the set value changes its identity. This is likely the reason (and really the only explanation) this part of the plan output:
Chances are that this is from the nested |
I was curious about
Since the Google provider generally stores lists in state as the empty list when Original:
Modified:
|
Yup, it's not the Internally the state looks like
while the proposed value from the config looks like:
|
@jbardin @rileykarson any proposed solution here? I'm not sure what fixing "the legacy SDK" might involve. This is a primary blocker for us migrating off of TF 0.11. We had a workaround for this with 0.11 by tweaking landscape to treat all sets as unordered. Landscape doesn't support 0.12 and they have no plans to. Our diffs are too large to read due to the length of some of the lists in our resources that are modified frequently. |
Could a workaround be to modify the provider or terraform CLI to write empty strings as null values? |
Is this a problem with legacy SDK? If so, we are using new terraform ( v0.12.24) and later google-provider(v3.19.0) and still facing the exact problem. |
I resorted to hacky scripting and my solution makes me so so sad, but allowed us to be functional with 0.12: I really hope a path forward for a fix here can be identified. I still don't understand where (if possible) I should make a PR to have the SDK line up with the state file when it comes to blank strings vs nulls. |
I'm from the BQ TF team and found this issue as it was recently mentioned again for |
Hi @wj-chen, the legacy SDK is essentially frozen and cannot be changed without breaking legacy providers. The Terraform Plugin Framework allows full access to the modern Terraform type system and can handle these types of changes between |
Thank you @jbardin. @rileykarson - what would be the next step for our providers that are impacted by this? |
We can cover this in a Google provider-specific issue / internal followup! Feel free to open a new issue if the one you got here from has been closed. Adopting the plugin framework (https://github.com/hashicorp/terraform-plugin-framework) over the SDK (https://github.com/hashicorp/terraform-plugin-sdk) is the answer, but it'll be a long/difficult migration for the provider as a whole. We're driving that on the core Google provider team. |
For anyone that discovers this down the line, the latest provider introduces
|
Terraform Version
Terraform Configuration Files
Debug Output
https://gist.github.com/rileykarson/830f562dc9c735f4e491777eea4c4a02
Expected Behavior
Actual Behavior
Steps to Reproduce
terraform apply
Additional References
See hashicorp/terraform-provider-google#3929
The text was updated successfully, but these errors were encountered: