如何从 Terraform 配置 Azure 托管磁盘的备份?

How to config backups of Azure Managed Disks from Terraform?

我想从 Azure 托管磁盘创建备份,如 this article 所说,但使用 terraform。

我可以将托管磁盘创建为:

resource "azurerm_managed_disk" "mongodb_disk" {
  name = "${var.env_name}-mongodb-disk"
  location = var.resource_group.location
  resource_group_name = var.resource_group.name
  create_option = "Empty"
  storage_account_type = "Premium_LRS"
  disk_size_gb = var.mongo_db_disk_size_in_gb
}

但是我找不到以下资源:

你能帮我用正确的 terraform 资源来创建备份吗?或者是否有任何示例,如何创建 Azure 托管磁盘的计划备份?

谢谢,

编辑:刚刚意识到 Azure Backup Vault 是 not yet supported in Terraform,您可以对该问题投赞成票。

对于 VM 备份,Azure Recovery Services Vault. A workaround could be for you to use an external terraform object 将 运行 PowerShell 或 Bash 脚本 (using Az Cli), to create the backup。它不是 100% IaC,但聊胜于无。