Skip to content

Commit

Permalink
azurerm_shared_image_version - `target_region.x.storage_account_typ…
Browse files Browse the repository at this point in the history
…e` is now defaulted and multiple `target_region`s can be added/removed (#6940)
  • Loading branch information
Neil Ye committed May 27, 2020
1 parent 2b5fc7f commit 459f232
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions azurerm/internal/services/compute/shared_image_version_resource.go
Expand Up @@ -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"
Expand Down Expand Up @@ -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),
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/shared_image_version.html.markdown
Expand Up @@ -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

Expand Down

0 comments on commit 459f232

Please sign in to comment.