Skip to content

Commit

Permalink
typo
Browse files Browse the repository at this point in the history
  • Loading branch information
ziyeqf committed Dec 8, 2023
1 parent 3364cbd commit 8ed382a
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 14 deletions.
2 changes: 1 addition & 1 deletion internal/features/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func Default() UserFeatures {
PreventDeletionIfContainsResources: true,
},
RecoveryServicesVault: RecoveryServicesVault{
RecoverSoftDeletedProtectedVm: true,
RecoverSoftDeletedBackupProtected: true,
},
TemplateDeployment: TemplateDeploymentFeatures{
DeleteNestedItemsDuringDeletion: true,
Expand Down
2 changes: 1 addition & 1 deletion internal/features/user_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,5 @@ type SubscriptionFeatures struct {
}

type RecoveryServicesVault struct {
RecoverSoftDeletedProtectedVm bool
RecoverSoftDeletedBackupProtected bool
}
8 changes: 4 additions & 4 deletions internal/provider/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func schemaFeatures(supportLegacyTestSuite bool) *pluginsdk.Schema {
// NOTE: if there's only one nested field these want to be Required (since there's no point
// specifying the block otherwise) - however for 2+ they should be optional
featuresMap := map[string]*pluginsdk.Schema{
//lintignore:XS003
// lintignore:XS003
"api_management": {
Type: pluginsdk.TypeList,
Optional: true,
Expand Down Expand Up @@ -189,7 +189,7 @@ func schemaFeatures(supportLegacyTestSuite bool) *pluginsdk.Schema {
},
},

//lintignore:XS003
// lintignore:XS003
"virtual_machine": {
Type: pluginsdk.TypeList,
Optional: true,
Expand Down Expand Up @@ -261,7 +261,7 @@ func schemaFeatures(supportLegacyTestSuite bool) *pluginsdk.Schema {
MaxItems: 1,
Elem: &pluginsdk.Resource{
Schema: map[string]*schema.Schema{
"recover_soft_deleted_protected_vm": {
"recover_soft_deleted_backup_protected_vm": {
Type: pluginsdk.TypeBool,
Optional: true,
Default: true,
Expand Down Expand Up @@ -480,7 +480,7 @@ func expandFeatures(input []interface{}) features.UserFeatures {
items := raw.([]interface{})
if len(items) > 0 && items[0] != nil {
appConfRaw := items[0].(map[string]interface{})
if v, ok := appConfRaw["recover_soft_deleted_protected_vm"]; ok {
if v, ok := appConfRaw["recover_soft_deleted_backup_protected_vm"]; ok {
featuresMap.RecoveryServicesVault.RecoverSoftDeletedProtectedVm = v.(bool)
}
}
Expand Down
8 changes: 4 additions & 4 deletions internal/provider/features_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func TestExpandFeatures(t *testing.T) {
},
"recovery_services_vault": []interface{}{
map[string]interface{}{
"recover_soft_deleted_protected_vm": true,
"recover_soft_deleted_backup_protected_vm": true,
},
},
"subscription": []interface{}{
Expand Down Expand Up @@ -273,7 +273,7 @@ func TestExpandFeatures(t *testing.T) {
},
"recovery_services_vault": []interface{}{
map[string]interface{}{
"recover_soft_deleted_protected_vm": false,
"recover_soft_deleted_backup_protected_vm": false,
},
},
"subscription": []interface{}{
Expand Down Expand Up @@ -1196,7 +1196,7 @@ func TestExpandFeaturesRecoveryServicesVault(t *testing.T) {
map[string]interface{}{
"recovery_services_vault": []interface{}{
map[string]interface{}{
"recover_soft_deleted_protected_vm": true,
"recover_soft_deleted_backup_protected_vm": true,
},
},
},
Expand All @@ -1213,7 +1213,7 @@ func TestExpandFeaturesRecoveryServicesVault(t *testing.T) {
map[string]interface{}{
"recovery_services_vault": []interface{}{
map[string]interface{}{
"recover_soft_deleted_protected_vm": false,
"recover_soft_deleted_backup_protected_vm": false,
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,10 +440,13 @@ func resourceRecoveryServicesVaultBackupProtectedVMrecoverSoftDeleted(ctx contex
IsRehydrate: pointer.To(true),
},
})
if err != nil {
return fmt.Errorf("issuing request for %s: %+v", id, err)
}

operationId, err := parseBackupOperationId(resp.HttpResponse)
if err != nil {
return fmt.Errorf("issuing request for %s: %+v", id, err)
return err
}

if err = resourceRecoveryServicesBackupProtectedVMWaitForStateCreateUpdate(ctx, opClient, id, operationId); err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,9 @@ resource "azurerm_virtual_machine" "test" {
storage_uri = azurerm_storage_account.test.primary_blob_endpoint
}
lifecycle {
ignore_changes = [tags, identity]
}
}
resource "azurerm_recovery_services_vault" "test" {
Expand Down Expand Up @@ -931,7 +934,11 @@ resource "azurerm_backup_protected_vm" "test" {
func (r BackupProtectedVmResource) basicWithSoftDelete(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
features {
recovery_services_vault {
recover_soft_deleted_backup_protected_vm = true
}
}
}
%s
Expand Down
4 changes: 2 additions & 2 deletions website/docs/guides/features-block.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ provider "azurerm" {
}
recovery_services_vault {
recover_soft_deleted_protected_vm = true
recover_soft_deleted_backup_protected_vm = true
}
subscription {
Expand Down Expand Up @@ -197,7 +197,7 @@ The `resource_group` block supports the following:

The `recovery_services_vault` block supports the following:

* `recover_soft_deleted_protected_vm` - (Optional) Should the `azurerm_backup_protected_vm` resource recover a Soft-Deleted protected VM? Defaults to `true`.
* `recover_soft_deleted_backup_protected_vm` - (Optional) Should the `azurerm_backup_protected_vm` resource recover a Soft-Deleted protected VM? Defaults to `true`.

---

Expand Down

0 comments on commit 8ed382a

Please sign in to comment.