Please vote on this issue by adding a :thumbsup: 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
Terraform Version
1.1.6
AzureRM Provider Version
3.3.0
Affected Resource(s)/Data Source(s)
data "azurerm_backup_policy_vm" "policy" and resource "azurerm_backup_protected_vm"
Terraform Configuration Files
I've enrolled my test VM in azure backups using the below code, and when I destroy my test machine it's deleting all other VM backups. Either VM's are their backups are not even managed by terraform other than just one test machine. I'm I doing anything wrong here?
code:
# terraform version
Terraform v1.1.6
on darwin_amd64
+ provider registry.terraform.io/hashicorp/azurerm v3.3.0
Your version of Terraform is out of date! The latest version
is 1.1.9. You can update by downloading from https://www.terraform.io/downloads.html
# cat modules/compute/main.tf
data "azurerm_backup_policy_vm" "policy" {
name = var.vm["backup_policy_name"]
recovery_vault_name = var.vm["backup_vault_name"]
resource_group_name = var.vm["backup_vault_resource_group"]
}
resource "azurerm_backup_protected_vm" "vm_protected_backup" {
resource_group_name = data.azurerm_backup_policy_vm.policy.resource_group_name
recovery_vault_name = data.azurerm_backup_policy_vm.policy.recovery_vault_name
source_vm_id = azurerm_linux_virtual_machine.vm.id
backup_policy_id = data.azurerm_backup_policy_vm.policy.id
}
Debug Output/Panic Output
# terraform destroy => Deleting vm1 and its associated resources.
module.subprod["vm1"].azurerm_backup_protected_vm.vm_protected_backup: Destroying... [id=/subscriptions/xxxx-xxx-xxxx-xxxx/resourceGroups/vault-rg/providers/Microsoft.RecoveryServices/vaults/vm-vault/backupFabrics/Azure/protectionContainers/IaasVMContainer;iaasvmcontainerv2;vm-rg;vm1/protectedItems/VM;iaasvmcontainerv2;vm-rg;vm1]
module.subprod["vm1"].azurerm_backup_protected_vm.vm_protected_backup: Still destroying... [id=/subscriptions/xxxx-xxx-xxxx-xxxx-...vm-rg;vm1, 10s elapsed]
module.subprod["vm1"].azurerm_backup_protected_vm.vm_protected_backup: Still destroying... [id=/subscriptions/xxxx-xxx-xxxx-xxxx-...vm-rg;vm1, 20s elapsed]
^CStopping operation...
Interrupt received.
Please wait for Terraform to exit or data loss may occur.
Gracefully shutting down...
╷
│ Error: waiting for the Azure Backup Protected VM "VM;iaasvmcontainerv2;vm-rg;vm1" to be false (Resource Group "vault-rg") to provision: context canceled
│
Is there an existing issue for this?
Community Note
Terraform Version
1.1.6
AzureRM Provider Version
3.3.0
Affected Resource(s)/Data Source(s)
data "azurerm_backup_policy_vm" "policy" and resource "azurerm_backup_protected_vm"
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
No response
Actual Behaviour
No response
Steps to Reproduce
No response
Important Factoids
No response
References
No response