Update backendbase to use empty strings from configuration, instead of looking for fallback or ENV values
#37877
+63
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #37846
In #37225 (a rebased version of #34990) the azure backend was updated to use the new
backendbasepackage instead of the legacy SDK. This was the last backend migrated over.Now, the structs representing remote-state backend implementations embed
backendbase.Base(example inazure). If the remote-state backend doesn't implement methods likePrepareConfigthen the implementation of that method inbackendbase.Baseis used instead.In the case of the original issue reported about the Azure backend, the
azurebackend doesn't implementPrepareConfigitself and instead uses the implementation inbackendbase.Base. In that method there is logic that didn't accurately mimic how the legacy SDK handled attributes that were explicitly set to an empty string in the configuration:Instead of using the empty string value like the legacy SDK, the new
backendbasepackage looks for any fallback values defined for that attribute in backend'sSDKLikeDefaultsvalues; default values defined in the schema or names of environment variables to use. The PrepareConfig method returns data about how the backend should be configured, a combo of config, schema defaults, and ENV values, and then Terraform Core then uses that value to configure the backend.This PR
backendbasepackage to detect non-null, string attributes that are set to""and uses that value, reverting behaviour back to match the legacy SDK.PrepareConfigstill includes the empty string, and that'll be used to configure the backend.Target Release
1.15.x
Rollback Plan
Changes to Security Controls
Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.
CHANGELOG entry