diff --git a/builtin/providers/vsphere/resource_vsphere_virtual_machine.go b/builtin/providers/vsphere/resource_vsphere_virtual_machine.go index 84e1cef8c..be49c99e7 100644 --- a/builtin/providers/vsphere/resource_vsphere_virtual_machine.go +++ b/builtin/providers/vsphere/resource_vsphere_virtual_machine.go @@ -439,6 +439,15 @@ func resourceVSphereVirtualMachineCreate(d *schema.ResourceData, meta interface{ } } } + + if ip, ok := d.GetOk("network_interface.0.ipv4_address"); ok { + d.SetConnInfo(map[string]string{ + "host": ip.(string), + }) + } else { + log.Printf("[DEBUG] Could not get IP address for %s", d.Id()) + } + d.SetId(vm.Path()) log.Printf("[INFO] Created virtual machine: %s", d.Id())