I’m currently setting up a Recovery Services Vault which is responsible for VM backups. This is a partial config for one vm:
resource "azurerm_recovery_services_vault" "vm_backups" {
name = "vm-backup-rsv-gwc-001"
resource_group_name = data.azurerm_resource_group.shared.name
location = data.azurerm_resource_group.shared.location
sku = "RS0"
public_network_access_enabled = true
# immutability = "Disabled"
storage_mode_type = "LocallyRedundant"
cross_region_restore_enabled = false
soft_delete_enabled = true
tags = {
"TerraformManaged" = "true"
}
}
data "azurerm_virtual_machine" "dev" {
name = "vm-dev-db2-gwc-001"
resource_group_name = "mds-dev-gwc"
}
resource "azurerm_backup_policy_vm" "dev" {
name = "dev-vm-recovery-vault-policy"
resource_group_name = azurerm_recovery_services_vault.vm_backups.resource_group_name
recovery_vault_name = azurerm_recovery_services_vault.vm_backups.name
policy_type = "V2"
timezone = local.germany_timezone
backup {
frequency = "Daily"
time = "04:00"
}
retention_daily {
count = 7 // this is the minimum
}
instant_restore_resource_group {
prefix = "backup-gwc-"
}
instant_restore_retention_days = 1
}
resource "azurerm_backup_protected_vm" "dev" {
resource_group_name = azurerm_recovery_services_vault.vm_backups.resource_group_name
recovery_vault_name = azurerm_recovery_services_vault.vm_backups.name
source_vm_id = data.azurerm_virtual_machine.dev.id
backup_policy_id = azurerm_backup_policy_vm.dev.id
}
What’s is not clear to me is if all disks attached to the VM will be included in the backup or not?
In the docs of azurerm_backup_protected_vm
I see those 2 parameters: exclude_disk_luns
, include_disk_luns
. But both are optional, therefore, if none is specifed what happens? How can I make sure I backup my VM including all the attached disks?
exclude_disk_luns
- (Optional) A list of Disks’ Logical Unit Numbers(LUN) to be excluded for VM Protection.include_disk_luns
- (Optional) A list of Disks’ Logical Unit Numbers(LUN) to be included for VM Protection.
UPDATE:
I run a backup manually and it seems it includes all disk by default. However, I consider this is a good information to be mentioned on the resource page of azurerm_backup_protected_vm
.