diff --git a/vsphere/resource_vsphere_virtual_machine.go b/vsphere/resource_vsphere_virtual_machine.go index 291e7fc96..5d4e9c10f 100644 --- a/vsphere/resource_vsphere_virtual_machine.go +++ b/vsphere/resource_vsphere_virtual_machine.go @@ -1065,6 +1065,9 @@ func resourceVSphereVirtualMachineRead(d *schema.ResourceData, meta interface{}) networkInterfaces := make([]map[string]interface{}, 0) deviceList, err := vm.Device(context.TODO()) + if err != nil { + return fmt.Errorf("failed to retrieve vm devices") + } deviceList = deviceList.SelectByType((*types.VirtualEthernetCard)(nil)) log.Printf("[DEBUG] Device list %+v", deviceList) for _, device := range deviceList {