diff --git a/azurerm/internal/services/compute/shared_image_version_resource.go b/azurerm/internal/services/compute/shared_image_version_resource.go index d108f7e84e90..46b9a6e02c62 100644 --- a/azurerm/internal/services/compute/shared_image_version_resource.go +++ b/azurerm/internal/services/compute/shared_image_version_resource.go @@ -8,6 +8,7 @@ import ( "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute" "github.com/hashicorp/go-azure-helpers/response" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/validate" @@ -84,11 +85,18 @@ func resourceArmSharedImageVersion() *schema.Resource { Required: true, }, + // The Service API doesn't support to update `storage_account_type`. So it has to recreate the resource for updating `storage_account_type`. + // However, `ForceNew` cannot be used since resource would be recreated while adding or removing `target_region`. + // And `CustomizeDiff` also cannot be used since it doesn't support in a `Set`. + // So currently terraform would directly return the error message from Service API while updating this property. If this property needs to be updated, please recreate this resource. "storage_account_type": { Type: schema.TypeString, Optional: true, - Computed: true, - ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + string(compute.StorageAccountTypeStandardLRS), + string(compute.StorageAccountTypeStandardZRS), + }, false), + Default: string(compute.StorageAccountTypeStandardLRS), }, }, }, diff --git a/website/docs/r/shared_image_version.html.markdown b/website/docs/r/shared_image_version.html.markdown index 86bacb341982..74417ec05fd9 100644 --- a/website/docs/r/shared_image_version.html.markdown +++ b/website/docs/r/shared_image_version.html.markdown @@ -73,7 +73,7 @@ The `target_region` block exports the following: * `regional_replica_count` - (Required) The number of replicas of the Image Version to be created per region. -* `storage_account_type` - (Optional) The storage account type for the image version, which defaults to `Standard_LRS`. You can store all of your image version replicas in Zone Redundant Storage by specifying `Standard_ZRS`. +* `storage_account_type` - (Optional) The storage account type for the image version. Possible values are `Standard_LRS` and `Standard_ZRS`. Defaults to `Standard_LRS`. You can store all of your image version replicas in Zone Redundant Storage by specifying `Standard_ZRS`. ## Attributes Reference