diff --git a/nutanix/resource_nutanix_virtual_machine.go b/nutanix/resource_nutanix_virtual_machine.go index 04d9f5b96..5aac4aea5 100644 --- a/nutanix/resource_nutanix_virtual_machine.go +++ b/nutanix/resource_nutanix_virtual_machine.go @@ -922,15 +922,17 @@ func resourceNutanixVirtualMachineRead(d *schema.ResourceData, meta interface{}) b := make([]string, 0) if resp.Status.Resources.BootConfig != nil { - if resp.Status.Resources.BootConfig.BootDevice.DiskAddress != nil { - i := strconv.Itoa(int(utils.Int64Value(resp.Status.Resources.BootConfig.BootDevice.DiskAddress.DeviceIndex))) - diskAddress["device_index"] = i - diskAddress["adapter_type"] = utils.StringValue(resp.Status.Resources.BootConfig.BootDevice.DiskAddress.AdapterType) + if resp.Status.Resources.BootConfig.BootDevice != nil { + if resp.Status.Resources.BootConfig.BootDevice.DiskAddress != nil { + i := strconv.Itoa(int(utils.Int64Value(resp.Status.Resources.BootConfig.BootDevice.DiskAddress.DeviceIndex))) + diskAddress["device_index"] = i + diskAddress["adapter_type"] = utils.StringValue(resp.Status.Resources.BootConfig.BootDevice.DiskAddress.AdapterType) + } + mac = utils.StringValue(resp.Status.Resources.BootConfig.BootDevice.MacAddress) } if resp.Status.Resources.BootConfig.BootDeviceOrderList != nil { b = utils.StringValueSlice(resp.Status.Resources.BootConfig.BootDeviceOrderList) } - mac = utils.StringValue(resp.Status.Resources.BootConfig.BootDevice.MacAddress) } d.Set("boot_device_order_list", b) @@ -1090,7 +1092,7 @@ func resourceNutanixVirtualMachineUpdate(d *schema.ResourceData, meta interface{ if d.HasChange("num_vcpus_per_socket") { o, n := d.GetChange("num_vcpus_per_socket") res.NumVcpusPerSocket = utils.Int64Ptr(int64(n.(int))) - if n.(int) < o.(int) { + if n.(int) < o.(int) || n.(int) > o.(int) { hotPlugChange = false } }