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_shared_image_version - target_region.x.storage_account_type is now defaulted and multiple target_regions can be added/removed #6940

Merged
merged 7 commits into from May 27, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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