Skip to content

Commit 7f31df3

Browse files
authored
Storage: Protect storageAccountsCache by lock in AccountKey() (#31323)
[BUGFIX] * `azurerm_storage_account` fix a panic in client caching
1 parent 881a749 commit 7f31df3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

internal/services/storage/client/helpers.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ func (ad *AccountDetails) AccountKey(ctx context.Context, client Client) (*strin
9494
}
9595

9696
// force-cache this
97+
cacheAccountsLock.Lock()
9798
storageAccountsCache[ad.StorageAccountId.StorageAccountName] = *ad
99+
cacheAccountsLock.Unlock()
98100

99101
return ad.accountKey, nil
100102
}

0 commit comments

Comments
 (0)