Powershell Windows自定义不使用terraform

Powershell Windows自定义不使用terraform,powershell,terraform,winrm,Powershell,Terraform,Winrm,我正在尝试使用terraform创建和自定义具有Windows虚拟机的基础结构。提供程序是VMWare vSphere。VM创建已正确完成,但客户端计算机内的自定义未正确完成。我的配置如下所示: resource "vsphere_virtual_machine" "vm" { count = "2" name = "${var.virtual_machine_name_prefix}${count.index}" resource_po

我正在尝试使用terraform创建和自定义具有Windows虚拟机的基础结构。提供程序是VMWare vSphere。VM创建已正确完成,但客户端计算机内的自定义未正确完成。我的配置如下所示:

resource "vsphere_virtual_machine" "vm" {
  count            = "2"
  name             = "${var.virtual_machine_name_prefix}${count.index}"
  resource_pool_id = "${data.vsphere_resource_pool.resource_pool.id}"
  host_system_id   = "${data.vsphere_host.host.*.id[count.index]}"
  datastore_id     = "${data.vsphere_datastore.datastore.id}"
    folder         = "my-vm-folder"
  num_cpus = 8
  memory   = 8192
  guest_id = "${data.vsphere_virtual_machine.template.guest_id}"

    scsi_type = "${data.vsphere_virtual_machine.template.scsi_type}"

  network_interface {
        # label             = "${data.vsphere_network.network.name}"
    network_id   = "${data.vsphere_network.network.id}"
    adapter_type = "${data.vsphere_virtual_machine.template.network_interface_types[0]}"
  }

  disk {
        label = "disk0"
    size = "${data.vsphere_virtual_machine.template.disks.0.size}"
  }

  clone {
    template_uuid = "${data.vsphere_virtual_machine.template.id}"

    customize {
      windows_options {
        computer_name = "${var.virtual_machine_name_prefix}${count.index}"
        full_name     = "${var.virtual_machine_name_prefix}${count.index}"
        organization_name = "myorg"
        join_domain = "mydomain.com"
        domain_admin_user = "admin"
        domain_admin_password = "P@ssword"
      }

            network_interface {
        dns_server_list = ["${var.virtual_machine_dns_servers}"]
      }    
    }
  }
}
每当我尝试创建时,收到的错误消息是:

* vsphere_virtual_machine.vm[1]: 1 error(s) occurred:

* vsphere_virtual_machine.vm.1:
Virtual machine customization failed on "/foldername/vm-name-1":

timeout waiting for customization to complete

The virtual machine has not been deleted to assist with troubleshooting. If
corrective steps are taken without modifying the "customize" block of the
resource configuration, the resource will need to be tainted before trying
again. For more information on how to do this, see the following page:
https://www.terraform.io/docs/commands/taint.html

terraform似乎无法与客户端VM通信,这导致超时。还有什么我需要提供给terraform来使用它的吗?

如果定制失败时VM屏幕上显示“Windows安装程序无法配置Windows在这台计算机的硬件上运行”,可能是sysprep在窃听。

您的模板是否有可用的IP地址?您是否找到了解决方案?我在部署Windows10模板时遇到了完全相同的问题。我的Windows服务器模板可以很好地进行部署和自定义。