-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
helper/schema: Remove timeouts during ImportResourceState (#1146)
Reference: #1145 Reference: hashicorp/terraform#32463 Terraform 1.3.8 and later now correctly handles null values for single nested blocks. This means Terraform will now report differences between a null block and known block with null values. This SDK only supported single nested blocks via its timeouts functionality. This change is a very targeted removal of any potential `timeouts` block values in a resource state from the `ImportResourceState` RPC. Since configuration is not available during that RPC, it is never valid to return any data beyond null for that block. This will prevent unexpected differences on the first plan after import, where Terraform will report the block removal for configurations which do not contain the block. New unit test failure prior to code updates: ``` --- FAIL: TestImportResourceState_Timeouts_Removed (0.00s) /Users/bflad/src/github.com/hashicorp/terraform-plugin-sdk/helper/schema/grpc_provider_test.go:1159: unexpected difference: cty.Value( - { - ty: cty.Type{typeImpl: cty.typeObject{AttrTypes: map[string]cty.Type{...}}}, - v: map[string]any{"id": string("test"), "string_attribute": nil, "timeouts": nil}, - }, + { + ty: cty.Type{typeImpl: cty.typeObject{AttrTypes: map[string]cty.Type{...}}}, + v: map[string]any{ + "id": string("test"), + "string_attribute": nil, + "timeouts": map[string]any{"create": nil, "read": nil}, + }, + }, ) ```
- Loading branch information
Showing
3 changed files
with
176 additions
and
0 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,6 @@ | ||
kind: BUG FIXES | ||
body: 'helper/schema: Prevented unexpected difference for timeouts on first plan after | ||
import' | ||
time: 2023-02-13T15:01:46.441029-05:00 | ||
custom: | ||
Issue: "1146" |
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