-
Notifications
You must be signed in to change notification settings - Fork 94
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
PlanResourceChange Always Showing Differences #181
Comments
The behavior added in #176 is on the right path, marking |
…knowns for Computed-only attributes in plans Reference: #181 Previously, any `Computed` attributes would always trigger plan differences due to the unknown marking. ``` Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: ~ update in-place Terraform will perform the following actions: # hashicups_order.edu will be updated in-place ~ resource "hashicups_order" "edu" { ~ id = "1" -> (known after apply) ~ items = [ ~ { ~ coffee = { + description = (known after apply) id = 3 ~ image = "/nomad.png" -> (known after apply) ~ name = "Nomadicano" -> (known after apply) ~ price = 150 -> (known after apply) ~ teaser = "Drink one today and you will want to schedule another" -> (known after apply) } # (1 unchanged attribute hidden) ~ coffee = { + description = (known after apply) id = 1 ~ image = "/packer.png" -> (known after apply) ~ name = "Packer Spiced Latte" -> (known after apply) ~ price = 350 -> (known after apply) ~ teaser = "Packed with goodness to spice up your images" -> (known after apply) } # (2 unchanged attributes hidden) }, ] ~ last_updated = "Tuesday, 28-Sep-21 11:53:27 EDT" -> (known after apply) } Plan: 0 to add, 1 to change, 0 to destroy. ``` This change limits the unknown marking to only be performed when there is actually a change between the `ProposedNewState` and `State`. Without a configuration change: ``` No changes. Your infrastructure matches the configuration. ``` With a configuration change: ``` Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: ~ update in-place Terraform will perform the following actions: # hashicups_order.edu will be updated in-place ~ resource "hashicups_order" "edu" { ~ id = "1" -> (known after apply) ~ items = [ ~ { ~ coffee = { + description = (known after apply) id = 3 ~ image = "/nomad.png" -> (known after apply) ~ name = "Nomadicano" -> (known after apply) ~ price = 150 -> (known after apply) ~ teaser = "Drink one today and you will want to schedule another" -> (known after apply) } # (1 unchanged attribute hidden) ~ coffee = { + description = (known after apply) ~ id = 1 -> 2 ~ image = "/packer.png" -> (known after apply) ~ name = "Packer Spiced Latte" -> (known after apply) ~ price = 350 -> (known after apply) ~ teaser = "Packed with goodness to spice up your images" -> (known after apply) } # (2 unchanged attributes hidden) }, ] ~ last_updated = "Tuesday, 28-Sep-21 11:53:27 EDT" -> (known after apply) } Plan: 0 to add, 1 to change, 0 to destroy. ``` As a followup, it may be necessary to invoke two passes of attribute and resource plan modifiers to ensure any changes captured by those modifiers triggers the unknown marking. As it stands now, a plan with no configuration changes, but changes due to plan modifiers will not correctly trigger the unknown marking. See also: #183
…knowns for Computed-only attributes in plans (#184) * tfsdk: Check ProposedNewState for State differences before marking unknowns for Computed-only attributes in plans Reference: #181 Previously, any `Computed` attributes would always trigger plan differences due to the unknown marking. ``` Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: ~ update in-place Terraform will perform the following actions: # hashicups_order.edu will be updated in-place ~ resource "hashicups_order" "edu" { ~ id = "1" -> (known after apply) ~ items = [ ~ { ~ coffee = { + description = (known after apply) id = 3 ~ image = "/nomad.png" -> (known after apply) ~ name = "Nomadicano" -> (known after apply) ~ price = 150 -> (known after apply) ~ teaser = "Drink one today and you will want to schedule another" -> (known after apply) } # (1 unchanged attribute hidden) ~ coffee = { + description = (known after apply) id = 1 ~ image = "/packer.png" -> (known after apply) ~ name = "Packer Spiced Latte" -> (known after apply) ~ price = 350 -> (known after apply) ~ teaser = "Packed with goodness to spice up your images" -> (known after apply) } # (2 unchanged attributes hidden) }, ] ~ last_updated = "Tuesday, 28-Sep-21 11:53:27 EDT" -> (known after apply) } Plan: 0 to add, 1 to change, 0 to destroy. ``` This change limits the unknown marking to only be performed when there is actually a change between the `ProposedNewState` and `State`. Without a configuration change: ``` No changes. Your infrastructure matches the configuration. ``` With a configuration change: ``` Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: ~ update in-place Terraform will perform the following actions: # hashicups_order.edu will be updated in-place ~ resource "hashicups_order" "edu" { ~ id = "1" -> (known after apply) ~ items = [ ~ { ~ coffee = { + description = (known after apply) id = 3 ~ image = "/nomad.png" -> (known after apply) ~ name = "Nomadicano" -> (known after apply) ~ price = 150 -> (known after apply) ~ teaser = "Drink one today and you will want to schedule another" -> (known after apply) } # (1 unchanged attribute hidden) ~ coffee = { + description = (known after apply) ~ id = 1 -> 2 ~ image = "/packer.png" -> (known after apply) ~ name = "Packer Spiced Latte" -> (known after apply) ~ price = 350 -> (known after apply) ~ teaser = "Packed with goodness to spice up your images" -> (known after apply) } # (2 unchanged attributes hidden) }, ] ~ last_updated = "Tuesday, 28-Sep-21 11:53:27 EDT" -> (known after apply) } Plan: 0 to add, 1 to change, 0 to destroy. ``` As a followup, it may be necessary to invoke two passes of attribute and resource plan modifiers to ensure any changes captured by those modifiers triggers the unknown marking. As it stands now, a plan with no configuration changes, but changes due to plan modifiers will not correctly trigger the unknown marking. See also: #183 Co-authored-by: Katy Moe <katy@katy.moe>
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. |
Module version
Relevant provider source code
Any schema with
Computed
only attributes. For example,hashicups-pf
:Terraform Configuration Files
Expected Behavior
With no configuration changes (e.g. v0.4.1 behavior):
Actual Behavior
With no configuration changes:
Steps to Reproduce
terraform apply
terraform apply
(with no configuration changes)References
The text was updated successfully, but these errors were encountered: