如何使用azurerm_backup_protected_vm terraform资源立即备份虚拟机



我正在尝试使用Terraform对恢复服务保险库中的Azure虚拟机进行备份。

已配置备份,且"Last Backup Status"为"Warning (Initial Backup pending)"。

我需要在配置备份后立即对虚拟机进行备份。

Below is my code:-

resource "azurerm_recovery_services_vault" "vault" {
name                = var.vaultname
location            = var.location
resource_group_name = var.rgname
sku                 = "Standard"
soft_delete_enabled = false
}
resource "azurerm_backup_policy_vm" "example" {
name                = "test-recovery-vault-policy"
resource_group_name = var.rgname
recovery_vault_name = azurerm_recovery_services_vault.vault.name
timezone = "UTC"
backup {
frequency = "Daily"
time      = "23:00"
}
retention_daily {
count = 10
}
retention_weekly {
count    = 42
weekdays = ["Sunday", "Wednesday", "Friday", "Saturday"]
}
retention_monthly {
count    = 7
weekdays = ["Sunday", "Wednesday"]
weeks    = ["First", "Last"]
}
retention_yearly {
count    = 77
weekdays = ["Sunday"]
weeks    = ["Last"]
months   = ["January"]
}
}
resource "azurerm_backup_protected_vm" "vm1" {
resource_group_name = var.rgname
recovery_vault_name = var.vaultname
source_vm_id        = var.vm_id
backup_policy_id    = azurerm_backup_policy_vm.example.id
}

已配置备份且Last Backup Status为Warning (Initial Backup)等待)。

你会得到这个警告,因为根据微软官方文档,它已经提到了同样的事情。

启用备份后,运行初始备份。你可以开始立即进行初始备份,或者按照备份计划。

在初始备份完成之前,Last backup状态显示为警告(初始备份挂起).

相关内容

  • 没有找到相关文章

最新更新