Skip to content

Commit abb8b51

Browse files
authored
azurerm_storage_account - can now update a Storage Standard ZRS account (hashicorp#31431)
[BUG] * `azurerm_storage_account` - can now update a Storage Standard ZRS account
1 parent 6814cbd commit abb8b51

File tree

2 files changed

+35
-4
lines changed

2 files changed

+35
-4
lines changed

internal/services/storage/storage_account_resource.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,10 +1707,8 @@ func resourceStorageAccountUpdate(d *pluginsdk.ResourceData, meta interface{}) e
17071707
storageType := fmt.Sprintf("%s%s_%s", accountTier, provisionedBillingModelVersion, replicationType)
17081708
accountKind := storageaccounts.Kind(d.Get("account_kind").(string))
17091709

1710-
if accountKind == storageaccounts.KindBlobStorage || accountKind == storageaccounts.KindStorage {
1711-
if storageType == string(storageaccounts.SkuNameStandardZRS) {
1712-
return fmt.Errorf("an `account_replication_type` of `ZRS` isn't supported for Blob Storage accounts")
1713-
}
1710+
if accountKind == storageaccounts.KindBlobStorage && storageType == string(storageaccounts.SkuNameStandardZRS) {
1711+
return fmt.Errorf("an `account_replication_type` of `ZRS` isn't supported for Blob Storage accounts")
17141712
}
17151713

17161714
existing, err := client.GetProperties(ctx, *id, storageaccounts.DefaultGetPropertiesOperationOptions())

internal/services/storage/storage_account_resource_test.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1618,6 +1618,13 @@ func TestAccStorageAccount_storageV1StandardZRS(t *testing.T) {
16181618
),
16191619
},
16201620
data.ImportStep(),
1621+
{
1622+
Config: r.storageV1StandardZRSUpdate(data),
1623+
Check: acceptance.ComposeTestCheckFunc(
1624+
check.That(data.ResourceName).ExistsInAzure(r),
1625+
),
1626+
},
1627+
data.ImportStep(),
16211628
})
16221629
}
16231630

@@ -4808,6 +4815,32 @@ resource "azurerm_storage_account" "test" {
48084815
`, data.RandomInteger, data.Locations.Primary, data.RandomString)
48094816
}
48104817

4818+
func (r StorageAccountResource) storageV1StandardZRSUpdate(data acceptance.TestData) string {
4819+
return fmt.Sprintf(`
4820+
provider "azurerm" {
4821+
features {}
4822+
}
4823+
4824+
resource "azurerm_resource_group" "test" {
4825+
name = "acctestRG-storage-%d"
4826+
location = "%s"
4827+
}
4828+
4829+
resource "azurerm_storage_account" "test" {
4830+
name = "unlikely23exst2acct%s"
4831+
resource_group_name = azurerm_resource_group.test.name
4832+
4833+
location = azurerm_resource_group.test.location
4834+
account_kind = "Storage"
4835+
account_tier = "Standard"
4836+
account_replication_type = "ZRS"
4837+
tags = {
4838+
environment = "production"
4839+
}
4840+
}
4841+
`, data.RandomInteger, data.Locations.Primary, data.RandomString)
4842+
}
4843+
48114844
func (r StorageAccountResource) smbMultichannel(data acceptance.TestData, enabled bool) string {
48124845
return fmt.Sprintf(`
48134846
provider "azurerm" {

0 commit comments

Comments
 (0)