azure - Azure 的 Terraform : storage_os_disk - invalid option

标签 azure centos terraform-provider-azure

尝试创建一个新的 Azure VM,并指定了创建空存储操作系统高级磁盘的选项,如下所示。不确定创建 100GB 大小的空磁盘的有效选项是什么。

    resource "azurerm_virtual_machine" "main" {
      name                  = "${var.prefix}-vm"
      location              = "${azurerm_resource_group.main.location}"
      resource_group_name   = "${azurerm_resource_group.main.name}"
      network_interface_ids = ["${azurerm_network_interface.main.id}"]
      vm_size               = "Standard_D4s_v3"

      # Uncomment this line to delete the OS disk automatically when 
    deleting the VM
      # delete_os_disk_on_termination = true


      # Uncomment this line to delete the data disks automatically when 
    deleting the VM
      # delete_data_disks_on_termination = true

      storage_image_reference {
        publisher = "Canonical"
        offer     = "CentOS"
        sku       = "7.4"
        version   = "latest"
      }
      storage_os_disk {
        name              = "myosdisk1"
        caching           = "ReadWrite"
        create_option     = "Empty"
        managed_disk_type = "Premium_LRS"
        disk_size_gb      = "100"
      }
      os_profile {
        computer_name  = "hostname"
        admin_username = "testadmin"
        admin_password = "Password1234!"
      }
      os_profile_linux_config {
        disable_password_authentication = false
      }
      tags = {
        environment = "test-nonprod-provisioning"
      }
    }

最佳答案

有效的选项是:

  • 附上
  • 来自图片

  • 空对 OS 磁盘没有意义

    https://docs.microsoft.com/en-us/rest/api/compute/virtualmachines/createorupdate#diskcreateoptiontypes

    关于azure - Azure 的 Terraform : storage_os_disk - invalid option,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56837560/

    相关文章:

    azure - 在 Terraform 中定义 Azure VM CustomScriptExtension (预期状态 'Element' ..遇到 'Text' ,名称 '' ,命名空间 '' 。\".")

    azure - 备份Azure中的APP注册设置

    azure - AADSTS700016 : UnauthorizedClient_DoesNotMatchRequest

    Bash Echo 转义序列

    centos - 最新版本的 CentOS 是否支持 Secure Boot?

    terraform - 通过 Terraform 为 Azure 应用服务(Web 应用)设置 VNet 集成

    azure - terraform application_security_group_ids 无效或未知 key

    具有存储帐户专用终结点的 Azure CDN

    python - 在 Azure Functions 中安装requirements.txt 时无法解析对 numpy 的依赖关系

    git pull 文件给出 500 错误