Skip to content

Commit

Permalink
provider/vsphere: Fix missing ssh connection info (#6293)
Browse files Browse the repository at this point in the history
  • Loading branch information
stack72 committed Apr 21, 2016
1 parent 408522c commit e213839
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion builtin/providers/vsphere/resource_vsphere_virtual_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,6 @@ func resourceVSphereVirtualMachineCreate(d *schema.ResourceData, meta interface{
}

func resourceVSphereVirtualMachineRead(d *schema.ResourceData, meta interface{}) error {

log.Printf("[DEBUG] reading virtual machine: %#v", d)
client := meta.(*govmomi.Client)
dc, err := getDatacenter(client, d.Get("datacenter").(string))
Expand Down Expand Up @@ -641,6 +640,16 @@ func resourceVSphereVirtualMachineRead(d *schema.ResourceData, meta interface{})
return fmt.Errorf("Invalid network interfaces to set: %#v", networkInterfaces)
}

ip, err := vm.WaitForIP(context.TODO())
if err != nil {
return err
}
log.Printf("[DEBUG] ip address: %v", ip)
d.SetConnInfo(map[string]string{
"type": "ssh",
"host": ip,
})

var rootDatastore string
for _, v := range mvm.Datastore {
var md mo.Datastore
Expand Down

0 comments on commit e213839

Please sign in to comment.