Skip to content
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

helper/schema: Remove timeouts during ImportResourceState #1146

Merged
merged 3 commits into from
Feb 14, 2023

Commits on Feb 13, 2023

  1. helper/schema: Remove timeouts during ImportResourceState

    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 committed Feb 13, 2023
    Configuration menu
    Copy the full SHA
    a66c69c View commit details
    Browse the repository at this point in the history
  2. Update CHANGELOG for #1146

    bflad committed Feb 13, 2023
    Configuration menu
    Copy the full SHA
    8dd3558 View commit details
    Browse the repository at this point in the history

Commits on Feb 14, 2023

  1. Configuration menu
    Copy the full SHA
    adf42cd View commit details
    Browse the repository at this point in the history