From 995d9e80e844127b3c6af54e9b448522b5088b80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robbert=20M=C3=BCller?= Date: Thu, 17 Aug 2017 08:18:25 +0200 Subject: [PATCH] add errorhanling --- vsphere/resource_vsphere_virtual_machine.go | 3 +++ 1 file changed, 3 insertions(+) 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 {