-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Cloud NAT gets recreated when adding the default values for some parameters #2977
Cloud NAT gets recreated when adding the default values for some parameters #2977
Comments
It appears that this API doesn't return values if we send empty values for these attributes, but sets these defaults uptream. Terraform doesn't have much it can do to remediate this situation unfortunately, as adding a Terraform-side default would constitute a breaking change (since it would cause a diff and recreate for users of the implicit defaults). While this could be worked around with a migration / diff suppression, I'm not sure it's worth the cost; is this a major problem for any of you, or is recreating in this situation acceptable? |
How do other API's work? Do other resources return default values if not set explicitly?
|
Can this ticket be re-examined in triage. I'm recommending we do don't make this change. |
|
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Community Note
Terraform Version
provider version 1.20
Affected Resource(s)
Expected Behavior
When adding a parameter with the default value, the resource should not get recreated.
Actual Behavior
Terraform sees a change: value gets changed from 0 to the default. It should have been the default value already. Now it sees a change and it recreates the resource.
Steps to Reproduce
Start with:
Terraform apply to create it.
Now add the following (defaults) to the tf file:
Run terraform plan/apply and see it forces a new resource because, for example:
udp_idle_timeout_sec: "0" => "30" (forces new resource)
Important Factoids
Can't work around the issue by using import. Even if the tf file already contains all the settings, the state file contains the "0" value in stead of the default value for each of the parameters. So perhaps the import piece has a bug as well?
References
#2773
b/301065933
The text was updated successfully, but these errors were encountered: