首页 > 解决方案 > 使用 Azure 进行 Terraform

问题描述

如何使用位于不同订阅存储帐户的自定义映像 (VHD) 创建 VM (diff SubscriptionID)。用过这个

storage_os_disk {
    name              = "${var.Servername}-os-disk"
    create_option     = "FromImage"
    caching           = "${var.disk_perm}"
    os_type           = "${var.ostype}"
    vhd_uri           = "https://myimages.blob.core.newone.net/myvhds/REDHAT7.vhd"
}

标签: azureterraformazure-virtual-machinevhd

解决方案


遗憾的是,您无法从不同订阅中的 VHD 文件创建 VM。您只需使用 VHD 文件在同一订阅和同一区域中创建 VM。不仅是虚拟机,镜像和快照也是同样的限制。

如果您确实想从 VHD 文件创建 VM,则必须将 VHD 文件复制到相同的订阅和区域中。我建议使用 AzCopy 工具。


推荐阅读