-
Notifications
You must be signed in to change notification settings - Fork 232
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
schema.ResourceData.GetRaw<whatever>()
not populated during provider configuration
#1270
Comments
Looks like this RPC was never setup for those |
…rovider Configure functions 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, } ```
Proposed fix: #1271 -- please give that a try and let us know if it resolves this issue. If so, we'll cut a bug fix release with it. Thanks! |
…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"}}, ) ```
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. |
SDK version
Relevant provider source code
Expected Behavior
The use case for using the
Raw
functions is to allow an empty string parameter in provider configs. To allow fallback behaviour to prevent a breaking change.The traditional
d.Get
,d.GetOk
, andd.GetOkExists
functions do not make a distinction between an empty string and the value not being set.Actual Behavior
The
cty.Value
s returned by theGetRaw<whatever>
functions are allNull
The text was updated successfully, but these errors were encountered: