title: VM creation using terraform in vsphere gives An error occurred while customizing VM
body: <pre><code>provider &quot;vsphere&quot; {
      vsphere_server = &quot;myserver&quot;
      user = &quot;myuser&quot;
      password = &quot;mypass&quot;
      allow_unverified_ssl = true
      version = &quot;v1.21.0&quot;
  }
  
  data &quot;vsphere_datacenter&quot; &quot;dc&quot; {
    name = &quot;pcloud-datacenter&quot;
  }
  
  data &quot;vsphere_datastore_cluster&quot; &quot;datastore_cluster&quot; {
    name          = &quot;pc-storage&quot;
    datacenter_id = data.vsphere_datacenter.dc.id
  }
  
  data &quot;vsphere_compute_cluster&quot; &quot;compute_cluster&quot; {
    name          = &quot;pcloud-cluster&quot;
    datacenter_id = data.vsphere_datacenter.dc.id
  }
  
  data &quot;vsphere_network&quot; &quot;network&quot; {
    name          = &quot;u32c01p26-1514&quot;
    datacenter_id = data.vsphere_datacenter.dc.id
  }
  
  
  data &quot;vsphere_virtual_machine&quot; &quot;vm_template&quot; {
    name          = &quot;first-terraform-vm&quot;
    datacenter_id = data.vsphere_datacenter.dc.id
  }
  
  
  resource &quot;vsphere_virtual_machine&quot; &quot;vm&quot; {
    count = 1
    name = &quot;first-terraform-vm-1&quot;
    resource_pool_id = data.vsphere_compute_cluster.compute_cluster.resource_pool_id
    datastore_cluster_id = data.vsphere_datastore_cluster.datastore_cluster.id
  
    num_cpus   = 2
    memory     = 1024
  
    wait_for_guest_ip_timeout = 2
    wait_for_guest_net_timeout = 0
  
    guest_id = data.vsphere_virtual_machine.vm_template.guest_id
  
    scsi_type = data.vsphere_virtual_machine.vm_template.scsi_type
  
    network_interface {
      network_id   = data.vsphere_network.network.id
      adapter_type = data.vsphere_virtual_machine.vm_template.network_interface_types[0]
    }
  
    disk {
      name             = &quot;disk0.vmdk&quot;
      size             = data.vsphere_virtual_machine.vm_template.disks.0.size
      eagerly_scrub    = data.vsphere_virtual_machine.vm_template.disks.0.eagerly_scrub
      thin_provisioned = data.vsphere_virtual_machine.vm_template.disks.0.thin_provisioned
    }
    
    folder = &quot;virtual-machines&quot;
  
    clone {
      template_uuid = data.vsphere_virtual_machine.vm_template.id
     
      customize {
        linux_options {
          host_name = &quot;first-terraform-vm-1&quot;
          domain = &quot;localhost.localdomain&quot;
        }
        network_interface {
          ipv4_address = &quot;10.10.14.100&quot;
          ipv4_netmask = 24
        }
        ipv4_gateway = &quot;10.10.14.1&quot;
      }
    }
  }
  
  </code></pre>
  <p>The command terraform script throws the below error</p>
  <pre><code>Error: 
  Virtual machine customization failed on &quot;/pcloud-datacenter/vm/virtual-machines/first-terraform-vm-1&quot;:
  
  An error occurred while customizing VM first-terraform-vm-1. For details reference the log file &lt;No Log&gt; in the guest OS.
  
  The virtual machine has not been deleted to assist with troubleshooting. If
  corrective steps are taken without modifying the &quot;customize&quot; 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
  
  
    on create_vm.tf line 34, in resource &quot;vsphere_virtual_machine&quot; &quot;vm&quot;:
    34: resource &quot;vsphere_virtual_machine&quot; &quot;vm&quot; {
  
  
  </code></pre>
  <p>Some how the generated vm &quot;first-terraform-vm-1&quot; doesn't have the connected box checked-in in network settings. While i checked my template &quot;first-terraform-vm&quot; it has network connected box checked-in.</p>
  <p>I see similar post in github <a href="https://github.com/hashicorp/terraform-provider-vsphere/issues/951" rel="nofollow noreferrer">https://github.com/hashicorp/terraform-provider-vsphere/issues/951</a>
  But not sure why this issue is still surfacing?</p>
  <p>Vsphere version: 6.7
  Terraform v0.12.28
  provider.vsphere v1.21.0</p>
  <p>Is there anything wrong with my template? Or am i missing something? Can anyone help please? Stuck with this for last 2 days.</p>