-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
User-supplied, empty values in the provider configuration should not be ignored and unused #14447
User-supplied, empty values in the provider configuration should not be ignored and unused #14447
Comments
This change could include addition of validation functions like : https://developer.hashicorp.com/terraform/plugin/framework/providers/validate-configuration#validateconfig-method |
Note: We may need to watch out for an intersection with GoogleCloudPlatform/magic-modules#8569, we probably just want to test a couple of cases |
Issue is still open due because GoogleCloudPlatform/magic-modules#9050 is needed to add user-facing validation on provider config values |
Closed with GoogleCloudPlatform/magic-modules#9050 |
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. |
Community Note
modular-magician
user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned tohashibot
, a community member has claimed the issue already.Terraform Version
N/A
This is related to a defect identified after introduction of v4.60.2
We have fixed the provider to have parity with the old behaviour, but in 5.0.0 we should remove the behaviour seen in <=4.59.0
Affected Resource(s)
N/A - is related to provider config
Terraform Configuration Files
Provider is configured by:
gcloud auth application-default login
Debug Output
N/A
Expected Behavior
When a user sets a value in their configuration it should override any environment variables. If a user sets
credentials = ""
, orproject=""
(for example) then the provider should attempt to use that value.Actual Behavior
In the old SDK version of the provider <=4.59.0 empty strings would be ignored and ENVs would be used instead.
After muxing was introduced to the provider the ignoring stopped, and we then changed to code to ensure parity with the un-muxed code.
Currently empty strings are ignored in provider configurations.
Steps to Reproduce
a. Running
gcloud auth application-default login
b. Unset any ENVs for configuring the provider
credentials = ""
terraform apply
<- error occurs hereImportant Factoids
The reason empty strings were ignored in the past is because the SDK made it hard to distinguish between Go's zero values and user-supplied values. After values were taken out of the
ResourceData
struct for the provider you lose any information about whether the value was set or not. Structs made using values from the provider config, i.e. theConfig
struct, have no way to distinguish between zero values and user values that match.References
The text was updated successfully, but these errors were encountered: