-
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
azurerm_backup_protected_vm - protection can now be suspended during destroy #27950
Conversation
This PR is being labeled as "stale" because it has not been updated for 30 or more days. If this PR is still valid, please remove the "stale" label. If this PR is blocked, please add it to the "Blocked" milestone. If you need some help completing this PR, please leave a comment letting us know. Thank you! |
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.
Hey @katbyte, this looks nearly there except for the test. We'll have to do some work to get this over the finish line and that test passing. After the duplicate provider config is removed, we'll hit the following:
=== CONT TestAccBackupProtectedVm_protectionSuspendedOnDestroy
testcase.go:173: Step 4/4 error: Error running apply: exit status 1
Error: setting protection to BackupsSuspended and retaining data for Protected Item (Subscription: "1a6092a6-137e-4025-9a7c-ef77f76f2c02"
Resource Group Name: "acctestRG-backup-250107164527989173"
Vault Name: "acctest-250107164527989173"
Backup Fabric Name: "Azure"
Protection Container Name: "iaasvmcontainer;iaasvmcontainerv2;acctestRG-backup-250107164527989173;acctestvm"
Protected Item Name: "VM;iaasvmcontainerv2;acctestRG-backup-250107164527989173;acctestvm"): protecteditems.ProtectedItemsClient#CreateOrUpdate: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="UserErrorOperationDeniedOnImmutableItem" Message="The Vault and Bakcup Item is in Immutable state where destructive operations are not supported. The Vault and Backup Item is immutable, hence operation is denied. Refer to the documentation to learn more: https://aka.ms/AB-ImmutableVaults-States "
panic.go:629: Error running post-test destroy, there may be dangling resources: exit status 1
Error: setting protection to BackupsSuspended and retaining data for Protected Item (Subscription: "1a6092a6-137e-4025-9a7c-ef77f76f2c02"
Resource Group Name: "acctestRG-backup-250107164527989173"
Vault Name: "acctest-250107164527989173"
Backup Fabric Name: "Azure"
Protection Container Name: "iaasvmcontainer;iaasvmcontainerv2;acctestRG-backup-250107164527989173;acctestvm"
Protected Item Name: "VM;iaasvmcontainerv2;acctestRG-backup-250107164527989173;acctestvm"): protecteditems.ProtectedItemsClient#CreateOrUpdate: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="UserErrorOperationDeniedOnImmutableItem" Message="The Vault and Bakcup Item is in Immutable state where destructive operations are not supported. The Vault and Backup Item is immutable, hence operation is denied. Refer to the documentation to learn more: https://aka.ms/AB-ImmutableVaults-States "
--- FAIL: TestAccBackupProtectedVm_protectionSuspendedOnDestroy (242.82s)
internal/services/recoveryservices/backup_protected_vm_resource.go
Outdated
Show resolved
Hide resolved
@@ -1098,6 +1117,21 @@ provider "azurerm" { | |||
`, r.baseWithOutProvider(data)) | |||
} | |||
|
|||
func (r BackupProtectedVmResource) protectionSuspendOnDestroy(data acceptance.TestData) string { | |||
return fmt.Sprintf(` | |||
provider "azurerm" { |
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.
This block is causing issues with the test
=== CONT TestAccBackupProtectedVm_protectionSuspendedOnDestroy
testcase.go:173: Step 4/4 error: Error running pre-apply plan: exit status 1
Error: Duplicate provider configuration
on terraform_plugin_test.tf line 41:
41: provider "azurerm" {
A default (non-aliased) provider configuration for "azurerm" was already
given at terraform_plugin_test.tf:31,1-19. If multiple configurations are
required, set the "alias" argument for alternative configurations.
panic.go:626: Error retrieving state, there may be dangling resources: exit status 1
Error: Duplicate provider configuration
on terraform_plugin_test.tf line 41:
41: provider "azurerm" {
A default (non-aliased) provider configuration for "azurerm" was already
given at terraform_plugin_test.tf:31,1-19. If multiple configurations are
required, set the "alias" argument for alternative configurations.
--- FAIL: TestAccBackupProtectedVm_protectionSuspendedOnDestroy (272.60s)
…e.go Co-authored-by: Matthew Frahry <[email protected]>
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.
This test is still failing post review updates
=== CONT TestAccBackupProtectedVm_protectionSuspendedOnDestroy
testcase.go:173: Step 4/4 error: Error running apply: exit status 1
Error: setting protection to BackupsSuspended and retaining data for Protected Item (Subscription: "1a6092a6-137e-4025-9a7c-ef77f76f2c02"
Resource Group Name: "acctestRG-backup-250107164527989173"
Vault Name: "acctest-250107164527989173"
Backup Fabric Name: "Azure"
Protection Container Name: "iaasvmcontainer;iaasvmcontainerv2;acctestRG-backup-250107164527989173;acctestvm"
Protected Item Name: "VM;iaasvmcontainerv2;acctestRG-backup-250107164527989173;acctestvm"): protecteditems.ProtectedItemsClient#CreateOrUpdate: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="UserErrorOperationDeniedOnImmutableItem" Message="The Vault and Bakcup Item is in Immutable state where destructive operations are not supported. The Vault and Backup Item is immutable, hence operation is denied. Refer to the documentation to learn more: https://aka.ms/AB-ImmutableVaults-States "
panic.go:629: Error running post-test destroy, there may be dangling resources: exit status 1
Error: setting protection to BackupsSuspended and retaining data for Protected Item (Subscription: "1a6092a6-137e-4025-9a7c-ef77f76f2c02"
Resource Group Name: "acctestRG-backup-250107164527989173"
Vault Name: "acctest-250107164527989173"
Backup Fabric Name: "Azure"
Protection Container Name: "iaasvmcontainer;iaasvmcontainerv2;acctestRG-backup-250107164527989173;acctestvm"
Protected Item Name: "VM;iaasvmcontainerv2;acctestRG-backup-250107164527989173;acctestvm"): protecteditems.ProtectedItemsClient#CreateOrUpdate: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="UserErrorOperationDeniedOnImmutableItem" Message="The Vault and Bakcup Item is in Immutable state where destructive operations are not supported. The Vault and Backup Item is immutable, hence operation is denied. Refer to the documentation to learn more: https://aka.ms/AB-ImmutableVaults-States "
--- FAIL: TestAccBackupProtectedVm_protectionSuspendedOnDestroy (242.82s)
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.
I figured out how to get this to work and it requires #27859 to be merged first. I've left a comment in line for what to do
|
||
data.ResourceTest(t, r, []acceptance.TestStep{ | ||
{ | ||
Config: r.basic(data), |
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.
Once #27859 is merged, we can update to use a new config here that uses an immutable vault as we can't suspend protection without an immutable vault.
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.
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.
LGTM!
* Update for #27950 * Update for #27824 * Update for #28592 #28583 #28599 #28590 #28453 * Update #28528 * Update for #27853 * Update CHANGELOG.md #28221 * Update for #27760 * Update CHANGELOG.md #28480 * Update CHANGELOG.md typo * Update CHANGELOG.md #28372 * Update CHANGELOG.md for #26047 also alphabetised ENHANCEMENTS * Update for #28146 * Update CHANGELOG.md #28013 * Update CHANGELOG.md for #28492 * Update CHANGELOG.md for #28648 * Update CHANGELOG.md for #28549 * Update for #28469 #28620 * prep for release * i touched it last --------- Co-authored-by: catriona-m <[email protected]> Co-authored-by: jackofallops <[email protected]> Co-authored-by: sreallymatt <[email protected]> Co-authored-by: Matthew Frahry <[email protected]> Co-authored-by: jackofallops <[email protected]>
Description
add provider feature vm_backup_suspend_protection_and_retain_data_on_destroy
Change Log
Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.
provider
- support for thevm_backup_suspend_protection_and_retain_data_on_destroy
feature [GH-00000]This is a (please select all that apply):
Related Issue(s)
Fixes #0000
Note
If this PR changes meaningfully during the course of review please update the title and description as required.