provider/vsphere: Fix missing ssh connection info (#6293)
This commit is contained in:
parent
408522c568
commit
e213839e58
|
@ -583,7 +583,6 @@ func resourceVSphereVirtualMachineCreate(d *schema.ResourceData, meta interface{
|
||||||
}
|
}
|
||||||
|
|
||||||
func resourceVSphereVirtualMachineRead(d *schema.ResourceData, meta interface{}) error {
|
func resourceVSphereVirtualMachineRead(d *schema.ResourceData, meta interface{}) error {
|
||||||
|
|
||||||
log.Printf("[DEBUG] reading virtual machine: %#v", d)
|
log.Printf("[DEBUG] reading virtual machine: %#v", d)
|
||||||
client := meta.(*govmomi.Client)
|
client := meta.(*govmomi.Client)
|
||||||
dc, err := getDatacenter(client, d.Get("datacenter").(string))
|
dc, err := getDatacenter(client, d.Get("datacenter").(string))
|
||||||
|
@ -641,6 +640,16 @@ func resourceVSphereVirtualMachineRead(d *schema.ResourceData, meta interface{})
|
||||||
return fmt.Errorf("Invalid network interfaces to set: %#v", networkInterfaces)
|
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
|
var rootDatastore string
|
||||||
for _, v := range mvm.Datastore {
|
for _, v := range mvm.Datastore {
|
||||||
var md mo.Datastore
|
var md mo.Datastore
|
||||||
|
|
Loading…
Reference in New Issue