vSphere Provider: If we only have one networkInterface, deviceID should (#8276)

be 0 to ensure that it selects the first element of the
networkInterfaces array.
This commit is contained in:
Calum Lacroix 2017-01-20 14:11:24 +00:00 committed by Paul Stack
parent 0cfda8fb17
commit ceccdb827a

View File

@ -1059,6 +1059,9 @@ func resourceVSphereVirtualMachineRead(d *schema.ResourceData, meta interface{})
}
if gatewaySetting != "" {
deviceID, err := strconv.Atoi(route.Gateway.Device)
if len(networkInterfaces) == 1 {
deviceID = 0
}
if err != nil {
log.Printf("[WARN] error at processing %s of device id %#v: %#v", gatewaySetting, route.Gateway.Device, err)
} else {