Error: "zone": conflicts with availability_set_id - Azure - Terraform

Error: "zone": conflicts with availability_set_id - Azure - Terraform

我们在 Azure 上有一些 Linux 个集群(每个集群两台机器)运行,我们希望在不同的区域中创建集群的每个节点并使用可用性集。

我们正在尝试使用 Terraform 在 Azure 上创建 VM:

resource "azurerm_linux_virtual_machine" "move-az-test" {
  count                            = "1"
  name                             = "move-az-test01"
  location                         = var.azure_location_short
  resource_group_name              = azurerm_resource_group.rg.name
  size                             = "Standard_B1S"
  zone                             = 1
  computer_name                    = "move-az01"
  disable_password_authentication  = true
  admin_username                   = var.os_user
  admin_password                   = var.os_password
  availability_set_id              = azurerm_availability_set.avset.id
  network_interface_ids            = [azurerm_network_interface.move-az-nic.id]

  source_image_reference {
    publisher = "OpenLogic"
    offer     = "CentOS"
    sku       = "7.6"
    version   = "latest"
  }

  os_disk {
    name                 = "move-az-test0_OsDisk"
    caching              = "ReadWrite"
    disk_size_gb         = "128"
    storage_account_type = "Standard_LRS"
  }
}

但我们收到消息错误:错误:“区域”:与 availability_set_id

冲突

简短的回答是 availability set and the availability zone 不能同时存在。您可以更深入地了解它们。前者在VM的逻辑分组中,后者提高了物理区域的可用性。