-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Upgrade dataprotection
API version from 2022-04-01 to 2023-05-01
#24143
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,9 +14,10 @@ import ( | |
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" | ||
"github.com/hashicorp/go-azure-helpers/resourcemanager/identity" | ||
"github.com/hashicorp/go-azure-helpers/resourcemanager/location" | ||
"github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults" | ||
"github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2023-05-01/backupvaults" | ||
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf" | ||
"github.com/hashicorp/terraform-provider-azurerm/internal/clients" | ||
"github.com/hashicorp/terraform-provider-azurerm/internal/features" | ||
"github.com/hashicorp/terraform-provider-azurerm/internal/tags" | ||
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" | ||
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" | ||
|
@@ -25,7 +26,7 @@ import ( | |
) | ||
|
||
func resourceDataProtectionBackupVault() *pluginsdk.Resource { | ||
return &pluginsdk.Resource{ | ||
resource := &pluginsdk.Resource{ | ||
Create: resourceDataProtectionBackupVaultCreateUpdate, | ||
Read: resourceDataProtectionBackupVaultRead, | ||
Update: resourceDataProtectionBackupVaultCreateUpdate, | ||
|
@@ -58,17 +59,6 @@ func resourceDataProtectionBackupVault() *pluginsdk.Resource { | |
|
||
"location": commonschema.Location(), | ||
|
||
"datastore_type": { | ||
Type: pluginsdk.TypeString, | ||
Required: true, | ||
ForceNew: true, | ||
ValidateFunc: validation.StringInSlice([]string{ | ||
string(backupvaults.StorageSettingStoreTypesArchiveStore), | ||
string(backupvaults.StorageSettingStoreTypesSnapshotStore), | ||
string(backupvaults.StorageSettingStoreTypesVaultStore), | ||
}, false), | ||
}, | ||
|
||
"redundancy": { | ||
Type: pluginsdk.TypeString, | ||
Required: true, | ||
|
@@ -84,6 +74,32 @@ func resourceDataProtectionBackupVault() *pluginsdk.Resource { | |
"tags": tags.Schema(), | ||
}, | ||
} | ||
|
||
// Confirm with the service team that `SnapshotStore` has been replaced with `OperationalStore`. | ||
if !features.FourPointOhBeta() { | ||
resource.Schema["datastore_type"] = &pluginsdk.Schema{ | ||
Type: pluginsdk.TypeString, | ||
Required: true, | ||
ForceNew: true, | ||
ValidateFunc: validation.StringInSlice([]string{ | ||
string(backupvaults.StorageSettingStoreTypesArchiveStore), | ||
"SnapshotStore", | ||
string(backupvaults.StorageSettingStoreTypesVaultStore), | ||
}, false), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason not to include the new There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a good idea to include |
||
} | ||
} else { | ||
resource.Schema["datastore_type"] = &pluginsdk.Schema{ | ||
Type: pluginsdk.TypeString, | ||
Required: true, | ||
ForceNew: true, | ||
ValidateFunc: validation.StringInSlice([]string{ | ||
string(backupvaults.StorageSettingStoreTypesArchiveStore), | ||
string(backupvaults.StorageSettingStoreTypesOperationalStore), | ||
string(backupvaults.StorageSettingStoreTypesVaultStore), | ||
}, false), | ||
} | ||
} | ||
return resource | ||
} | ||
|
||
func resourceDataProtectionBackupVaultCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { | ||
|
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a question that still needs answering by the service team?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this has been confirmed by the service team.