Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Updatebackendbase to use empty strings from configuration, instead of looking for fallback or ENV values#37877

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
SarahFrench wants to merge4 commits intomain
base:main
Choose a base branch
Loading
fromazure/fix-empty-string-ignore

Conversation

@SarahFrench
Copy link
Member

@SarahFrenchSarahFrench commentedNov 5, 2025
edited
Loading

Fixes#37846

In#37225 (a rebased version of#34990) the azure backend was updated to use the newbackendbase package instead of the legacy SDK. This was the last backend migrated over.

Now, the structs representing remote-state backend implementations embedbackendbase.Base (example inazure). If the remote-state backend doesn't implement methods likePrepareConfig then the implementation of that method inbackendbase.Base is used instead.

In the case of the original issue reported about the Azure backend, theazure backend doesn't implementPrepareConfig itself 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:

backend"foobar" {value=""}

Instead of using the empty string value like the legacy SDK, the newbackendbase package looks for any fallback values defined for that attribute in backend'sSDKLikeDefaults values; 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

  • Updates thebackendbase package to detect non-null, string attributes that are set to"" and uses that value, reverting behaviour back to match the legacy SDK.
    • This means the data received by Terraform Core fromPrepareConfig still includes the empty string, and that'll be used to configure the backend.
  • Adds a test that asserts neither fallback default values or ENVs are used when an attribute is set to an empty string.
  • Updates existing test.

Target Release

1.15.x

Rollback Plan

  • If a change needs to be reverted, we will roll out an update to the code within 7 days.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

CHANGELOG entry

  • This change is user-facing and I added a changelog entry.
  • This change is not user-facing.

…stead of ignoring them and looking for ENVs or fallback values. Add test coverage.
Previously the test assumed if the default wasn't used then no ENV would be used either.
@SarahFrench
Copy link
MemberAuthor

SarahFrench commentedNov 5, 2025
edited
Loading

FYI @hashicorp/terraform-azure :

The reported error is not specific to the Azure backend, but I explored adding a test that shows empty strings are used specifically in theazure backend. I've made a PR here (#37878) that contains a test but I don't expect to/want to merge it as there was a small change needed in the remote-state/azureBackend struct needed to enable the test.

@SarahFrenchSarahFrench marked this pull request as ready for reviewNovember 5, 2025 13:32
@SarahFrenchSarahFrench requested a review froma team as acode ownerNovember 5, 2025 13:32
@SarahFrenchSarahFrench marked this pull request as draftNovember 5, 2025 13:38
})
}

funcTestBase_emptyStringsUsed(t*testing.T) {
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I've realised this overlaps somewhat withTestSDKLikeApplyEnvDefaults, but maybe it's useful to have this as a more explicit regression test?

mildwonkey reacted with thumbs up emoji
@SarahFrenchSarahFrench marked this pull request as ready for reviewNovember 5, 2025 13:48
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Azurerm Backend Configuration Behaviour Change

1 participant

@SarahFrench

[8]ページ先頭

©2009-2025 Movatter.jp