Skip to content

Commit

Permalink
vSphere Provider: If we only have one networkInterface, deviceID shou…
Browse files Browse the repository at this point in the history
…ld (#8276)

be 0 to ensure that it selects the first element of the
networkInterfaces array.
  • Loading branch information
cvlc authored and stack72 committed Jan 20, 2017
1 parent 0cfda8f commit ceccdb8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions builtin/providers/vsphere/resource_vsphere_virtual_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

1 comment on commit ceccdb8

@jgeerds
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! 👍

Please sign in to comment.