Data Source: azurerm_storage_account_sas - fix regression silently dropping permissions#32234
Merged
sreallymatt merged 1 commit intohashicorp:mainfrom Apr 23, 2026
Conversation
…as data source PR hashicorp#32149 replaced BuildPermissionsString with BuildContainerPermissionsString, which uses different map keys (tags/find/delete_version/etc.) and different letter mappings (p=permissions not process) than the account SAS schema, producing incorrect SAS tokens for account-level signatures.
sreallymatt
approved these changes
Apr 23, 2026
Collaborator
sreallymatt
left a comment
There was a problem hiding this comment.
Thanks @ReinierRothuis - LGTM ✅
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Community Note
Description
This PR fixes a regression introduced in #32149 for the
data.azurerm_storage_account_sasdata source.Problem
In #32149 the call site at
internal/services/storage/storage_account_sas_data_source.go:212was changed fromBuildPermissionsStringtoBuildContainerPermissionsString. These two helpers target different SAS surfaces and use different key/letter mappings:BuildPermissionsStringBuildContainerPermissionsStringreadrrrwritewwwdeletedddlistllladdaaacreatecccupdateuuprocessppponly if map key ispermissions(wrong meaning)tagtttags)filterfffind)The result: account SAS tokens produced by this data source on v4.69.0 silently lose
update,process,tag, andfilter, which breaks previously-working configurations (e.g.read + tag + filterreturned onlyr).Fix
Revert the call at
storage_account_sas_data_source.go:212back toBuildPermissionsStringwhile keeping theOptionalpermissions nil-guard introduced in #32149.BuildPermissionsStringalready matches the account SAS schema's keys and letters and its unit test (TestAccDataSourceStorageAccountSas_permissionsString) exercises all 10 keys.PR Checklist
Changes to existing Resource / Data Source
Testing
Ran the existing unit tests that cover the affected helpers:
TestAccDataSourceStorageAccountSas_permissionsStringexercises all 10 schema keys (read/write/delete/list/add/create/update/process/tag/filter) and their expected letters, so it already provides regression coverage for this fix — no new test was required.Change Log
data.azurerm_storage_account_sas- fix regression whereupdate,process,tagandfilterpermissions were silently dropped from the generated SAS token [data.azurerm_storage_account_sas silently dropstagandfilterpermissions since v4.69.0 (regression from #32149) #32229]This is a (please select all that apply):
Related Issue(s)
Fixes #32229
AI Assistance Disclosure
Claude Code was used to help investigate the regression, draft the fix, run the local build/unit tests, and draft this PR description. The root cause, fix, and text were reviewed and confirmed by the contributor before submission.
Rollback Plan
If a change needs to be reverted, we will publish an updated version of the provider.
Changes to Security Controls
No changes to security controls. Note that this fix restores the previously-correct behaviour of SAS token permissions — pre-#32149 configurations relying on
update/process/tag/filterwill once again include those permissions in the generated token, as originally intended.