Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azurerm_storage_account: make large_file_share_enabled optional+computed again #26968

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 9 additions & 16 deletions internal/services/storage/storage_account_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -823,18 +823,11 @@ func resourceStorageAccount() *pluginsdk.Resource {
Default: false,
},

"large_file_share_enabled": func() *pluginsdk.Schema {
s := &pluginsdk.Schema{
Type: pluginsdk.TypeBool,
Optional: true,
Default: false, // @tombuildsstuff: this now defaults to `true` when `account_kind` is set to `FileStorage`
}
if !features.FourPointOhBeta() {
s.Computed = true
s.Default = nil
}
return s
}(),
"large_file_share_enabled": {
Type: pluginsdk.TypeBool,
Optional: true,
Computed: true,
},

"local_user_enabled": {
Type: pluginsdk.TypeBool,
Expand Down Expand Up @@ -1380,13 +1373,13 @@ func resourceStorageAccountCreate(d *pluginsdk.ResourceData, meta interface{}) e

// BlobStorage does not support ZRS
if accountKind == storageaccounts.KindBlobStorage && string(payload.Sku.Name) == string(storageaccounts.SkuNameStandardZRS) {
return fmt.Errorf("a `account_replication_type` of `ZRS` isn't supported for Blob Storage accounts")
return fmt.Errorf("`account_replication_type` of `ZRS` isn't supported for Blob Storage accounts")
}

accessTier, accessTierSetInConfig := d.GetOk("access_tier")
_, skuTierSupported := storageKindsSupportsSkuTier[accountKind]
if !skuTierSupported && accessTierSetInConfig {
keys := sortedKeysFromSlice(storageKindsSupportHns)
keys := sortedKeysFromSlice(storageKindsSupportsSkuTier)
return fmt.Errorf("`access_tier` is only available for accounts of kind set to one of: %+v", strings.Join(keys, " / "))
}
if skuTierSupported {
Expand Down Expand Up @@ -1417,8 +1410,8 @@ func resourceStorageAccountCreate(d *pluginsdk.ResourceData, meta interface{}) e
}

// AccountTier must be Premium for FileStorage
if accountKind == storageaccounts.KindFileStorage && accountTier == storageaccounts.SkuTierStandard {
return fmt.Errorf("a `account_tier` of `Standard` is not supported for FileStorage accounts")
if accountKind == storageaccounts.KindFileStorage && accountTier != storageaccounts.SkuTierPremium {
return fmt.Errorf("`account_tier` must be `Premium` for File Storage accounts")
}

// nolint staticcheck
Expand Down
9 changes: 0 additions & 9 deletions internal/services/storage/storage_account_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -914,13 +914,6 @@ func TestAccStorageAccount_largeFileShare(t *testing.T) {
),
},
data.ImportStep(),
{
Config: r.largeFileShareDisabled(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("large_file_share_enabled").HasValue("false"),
),
},
})
}

Expand Down Expand Up @@ -4122,7 +4115,6 @@ resource "azurerm_storage_account" "test" {
account_tier = "Premium"
account_replication_type = "LRS"
infrastructure_encryption_enabled = true
large_file_share_enabled = true # defaulted on the API side
}
`, data.RandomInteger, data.Locations.Primary, data.RandomString)
}
Expand Down Expand Up @@ -4612,7 +4604,6 @@ resource "azurerm_storage_account" "test" {
account_tier = "Premium"
account_kind = "FileStorage"
account_replication_type = "ZRS"
large_file_share_enabled = true # defaulted in the API when FileStorage & Premium

share_properties {
smb {
Expand Down
Loading