-
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
ImportResourceState Errantly Includes timeouts in State #1145
Comments
bflad
added a commit
that referenced
this issue
Feb 13, 2023
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}, + }, + }, ) ```
bflad
added a commit
that referenced
this issue
Feb 14, 2023
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}, + }, + }, ) ```
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. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
SDK version
Relevant provider source code
Or potentially any resource with:
Terraform Configuration Files
Expected Behavior
After importing a resource, Terraform plans should never contain anything relating to the SDK-defined
timeouts
block.Actual Behavior
The imported state contains a
timeouts
single nested block withcreate
anddelete
set tonull
.Steps to Reproduce
For
aws_security_group
:terraform import aws_security_group.test sg-0329f3c7cf561ad15
terraform plan
orterraform plan -refresh=false
References
The text was updated successfully, but these errors were encountered: