-
Notifications
You must be signed in to change notification settings - Fork 233
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
Output block causes diffs on terraform plan for map field #1371
Comments
Hey there @zli82016 👋🏻, thanks for reporting the bug and sorry you're running into trouble here. What you're describing here sounds like a data consistency issue in the provider + SDKv2. That data discrepancy is only being shown by adding the The problem here is that in this configuration, resource "google_storage_bucket" "guins_bucket_tf" {
name = "guins-bucket-tf"
location = "US"
# labels is not present in the configuration
} In the provider, it looks like regardless of the config value for This by itself would be a data consistency issue (config value needs to be preserved, aka So the overall sequence of events that occur:
Unfortunately, this is something that SDKv2 cannot be easily modified to fix as a good chunk of the provider ecosystem rely on this legacy behavior, compounding on that, The only real end solution is to eventually migrate the resource over to One note, during migration you'll want to cover the cases of previous versions of the resource having empty maps in state, despite their config values being
Another semi-related issue that suffers from the same problem: #1101 |
@austinvalle , thank you for the detailed information. I got the reason. Migrating the resource over to terraform-plugin-framework is on the plan. |
SDK version
Relevant provider source code
Terraform Configuration Files
Debug Output
Expected Behavior
terraform apply should show no diff
Actual Behavior
terraform apply shows diff on labels:
The output block causes the diffs. Without the output block, no diffs is observed in the second
terraform apply
.Other fields with
schema.TypeMap
have the same issue. I tested with theresource_tags
field ingoogle_bigquery_table
resource.Can you help understand the reason that the output block causes the diffs in the second
terraform apply
? Is it a bug in Terraform core? Thanks.Steps to Reproduce
terraform apply
to create the resourceterraform apply
to get the diffs in the planReferences
The text was updated successfully, but these errors were encountered: