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

Support for retain vm backup when deleting azurerm_backup_protected_vm resource #20571

Closed
1 task done
jsathler opened this issue Feb 20, 2023 · 2 comments · Fixed by #20608
Closed
1 task done

Support for retain vm backup when deleting azurerm_backup_protected_vm resource #20571

jsathler opened this issue Feb 20, 2023 · 2 comments · Fixed by #20608

Comments

@jsathler
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

The resource "azurerm_backup_protected_vm" has the option to enable backup on VM, but when destroying the infrastructure the backup is also deleted.

It would be great to have a property to retain the backup when deleting the resource "azurerm_backup_protected_vm".

This is different from deleting a backup for a VM in a vault protected with soft delete, since soft delete keeps the existing backups only for 14 days, not according to the existing vault policy.

New or Affected Resource(s)/Data Source(s)

azurerm_backup_protected_vm

Potential Terraform Configuration

resource "azurerm_backup_protected_vm" "vm1" {
  resource_group_name = azurerm_resource_group.example.name
  recovery_vault_name = azurerm_recovery_services_vault.example.name
  source_vm_id        = data.azurerm_virtual_machine.example.id
  backup_policy_id    = azurerm_backup_policy_vm.example.id

  stop_protection_and_retain_data = true
}

References

Azure Backup provides you the flexibility to stop protecting and manage your backups:

Stop protection and retain backup data. If you're retiring or decommissioning your data source (VM, application), but need to retain data for audit or compliance purposes, then you can use this option to stop all future backup jobs from protecting your data source and retain the recovery points that have been backed up. You can then restore or resume VM protection.

Stop protection and delete backup data. This option will stop all future backup jobs from protecting your VM and delete all the recovery points. You won't be able to restore the VM nor use Resume backup option.

@ziyeqf
Copy link
Contributor

ziyeqf commented Feb 22, 2023

Hi @jsathler,

submitted a PR (#20608) for this feature, you can subscribe it to get notification when it merged/release, and please note delete/destroy azurerm_backup_protected_vm by Terraform will still delete the backups.

Thanks.

Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.