Error: error cloning virtual machine: An error occurred while communicating with the remote host

I’m using vsphere_virtual_machine to clone a vm template.

It fails regularly when the VM template is not on the same Datastore it’s cloning to.

These are the 2 errors I regularly face:

  • Error: error cloning virtual machine: An error occurred while communicating with the remote host.
  • Error: error cloning virtual machine: Could not complete network copy for file /vmfs/volumes/xxxxx/ubuntu/ubuntu.vmdk

Anything I can do to debug furthur or wait longer during clone.

I have tried

resource "vsphere_virtual_machine" "this" {
...
  clone {
    template_uuid = data.vsphere_virtual_machine.template.id
    timeout = 60
  }
}

Update: I do not get these errors when I clone via the vSphere web client.

I’m not familiar with this provider or vSphere’s web client but when I run into things like this, I often pull up the developer tools in a browser and see what the web client is sending for payloads. It helps to see if there is a specific timeout, etc. being sent with the request that may be different than how the TF is implemented.