Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
helper/schema: Ensure (ResourceData).GetRawConfig() is populated in p…
…rovider Configure functions (#1271) Reference: #1270 This change is intended to be as targeted as possible to prevent other unintended changes. In other RPCs, the protocol configuration data is able to be set upfront via `terraform.InstanceState`, however for provider configuration it is still using the legacy `terraform.ResourceConfig` value which previously did not have the same data field. This adds the data field while trying to be pragmatic about potentially breaking compatibility with the unfortunately exported APIs in this SDK. New test failures prior to updating logic: ``` --- FAIL: TestProviderConfigure (0.00s) --- FAIL: TestProviderConfigure/ConfigureContextFunc-GetRawConfig (0.00s) /Users/bflad/src/github.com/hashicorp/terraform-plugin-sdk/helper/schema/provider_test.go:338: Unexpected diagnostics (-wanted +got): diag.Diagnostics( - nil, + {{Summary: "unexpected GetRawConfig difference: expected: {{{{} map[test:{{{"...}}, ) --- FAIL: TestProviderConfigure/ConfigureFunc-GetRawConfig (0.00s) /Users/bflad/src/github.com/hashicorp/terraform-plugin-sdk/helper/schema/provider_test.go:338: Unexpected diagnostics (-wanted +got): diag.Diagnostics( - nil, + {{Summary: "unexpected GetRawConfig difference: expected: {{{{} map[test:{{{"...}}, ) --- FAIL: TestGRPCProviderServerConfigureProvider (0.00s) --- FAIL: TestGRPCProviderServerConfigureProvider/ConfigureContextFunc-GetRawConfig (0.00s) /Users/bflad/src/github.com/hashicorp/terraform-plugin-sdk/helper/schema/grpc_provider_test.go:343: unexpected difference: &tfprotov5.ConfigureProviderResponse{ - Diagnostics: []*tfprotov5.Diagnostic{ - &{ - Severity: s"ERROR", - Summary: "unexpected difference: expected: {{{{} map[test:{{{} %!s(cty.pri"..., - }, - }, + Diagnostics: nil, } --- FAIL: TestGRPCProviderServerConfigureProvider/ConfigureFunc-GetRawConfig (0.00s) /Users/bflad/src/github.com/hashicorp/terraform-plugin-sdk/helper/schema/grpc_provider_test.go:343: unexpected difference: &tfprotov5.ConfigureProviderResponse{ - Diagnostics: []*tfprotov5.Diagnostic{ - &{ - Severity: s"ERROR", - Summary: "unexpected difference: expected: {{{{} map[test:{{{} %!s(cty.pri"..., - }, - }, + Diagnostics: nil, } ``` This change also fixes `GetOkExists()` handling for provider configuration. Updated tests prior to logic updates: ``` --- FAIL: TestProviderConfigure (0.00s) --- FAIL: TestProviderConfigure/ConfigureContextFunc-GetOkExists-zero-value (0.00s) /Users/bflad/src/github.com/hashicorp/terraform-plugin-sdk/helper/schema/provider_test.go:924: Unexpected diagnostics (-wanted +got): diag.Diagnostics( - nil, + {{Summary: "unexpected GetOkExists difference: expected: false, got: true"}}, ) --- FAIL: TestProviderConfigure/ConfigureFunc-GetOkExists-zero-value (0.00s) /Users/bflad/src/github.com/hashicorp/terraform-plugin-sdk/helper/schema/provider_test.go:924: Unexpected diagnostics (-wanted +got): diag.Diagnostics( - nil, + {{Summary: "unexpected GetOkExists difference: expected: false, got: true"}}, ) ```
- Loading branch information