-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/fwserver: Use response plan value instead of request with ne…
…sted attributes and blocks (#669) Reference: #644 Reference: https://discuss.hashicorp.com/t/framework-v1-1-1-strategies-for-diagnosing-resource-state-churn/49688 The attribute and block plan modification logic must preserve any changes made by the "top level" list/map/set/single nested attribute/block plan modifiers before continuing on to nested attributes/blocks. New unit testing failures prior to the logic change: ``` --- FAIL: TestAttributeModifyPlan (0.00s) --- FAIL: TestAttributeModifyPlan/attribute-list-nested-usestateforunknown (0.00s) attribute_plan_modification_test.go:1107: Unexpected response (-wanted, +got): fwserver.ModifyAttributePlanResponse{ - AttributePlan: s`[{"nested_computed":"statevalue1"}]`, + AttributePlan: s"[]", Diagnostics: nil, RequiresReplace: s"[]", Private: nil, } --- FAIL: TestAttributeModifyPlan/attribute-map-nested-usestateforunknown (0.00s) attribute_plan_modification_test.go:1107: Unexpected response (-wanted, +got): fwserver.ModifyAttributePlanResponse{ - AttributePlan: s`{"key1":{"nested_computed":"statevalue1"}}`, + AttributePlan: s"{}", Diagnostics: nil, RequiresReplace: s"[]", Private: nil, } --- FAIL: TestAttributeModifyPlan/attribute-single-nested-usestateforunknown (0.00s) attribute_plan_modification_test.go:1107: Unexpected response (-wanted, +got): fwserver.ModifyAttributePlanResponse{ - AttributePlan: s`{"nested_computed":"statevalue1"}`, + AttributePlan: s`{"nested_computed":<unknown>}`, Diagnostics: nil, RequiresReplace: s"[]", Private: nil, } --- FAIL: TestAttributeModifyPlan/attribute-set-nested-usestateforunknown (0.00s) attribute_plan_modification_test.go:1107: Unexpected response (-wanted, +got): fwserver.ModifyAttributePlanResponse{ - AttributePlan: s`[{"nested_computed":"statevalue1"}]`, + AttributePlan: s"[]", Diagnostics: nil, RequiresReplace: s"[]", Private: nil, } --- FAIL: TestBlockModifyPlan (0.00s) --- FAIL: TestBlockModifyPlan/block-list-usestateforunknown (0.00s) /Users/bflad/src/github.com/hashicorp/terraform-plugin-framework/internal/fwserver/block_plan_modification_test.go:2338: Unexpected response (+wanted, -got): fwserver.ModifyAttributePlanResponse{ - AttributePlan: s`[{"nested_computed":"statevalue1"}]`, + AttributePlan: s"[]", Diagnostics: nil, RequiresReplace: s"[]", Private: nil, } --- FAIL: TestBlockModifyPlan/block-set-usestateforunknown (0.00s) /Users/bflad/src/github.com/hashicorp/terraform-plugin-framework/internal/fwserver/block_plan_modification_test.go:2338: Unexpected response (+wanted, -got): fwserver.ModifyAttributePlanResponse{ - AttributePlan: s`[{"nested_computed":"statevalue1"}]`, + AttributePlan: s"[]", Diagnostics: nil, RequiresReplace: s"[]", Private: nil, } FAIL ```
- Loading branch information
Showing
5 changed files
with
463 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
kind: BUG FIXES | ||
body: 'resource: Prevented nested attribute and block plan modifications from being undone' | ||
time: 2023-02-10T09:21:36.848573-05:00 | ||
custom: | ||
Issue: "669" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.