Skip to content

Commit

Permalink
fix: pointer comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
fad3t committed Oct 24, 2023
1 parent 89563ac commit 7a6668f
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions nutanix/resource_nutanix_virtual_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -1255,15 +1255,20 @@ func getVMSpecVersion(conn *v3.Client, vmID string) (*int64, error) {
func bootConfigHasChange(boot *v3.VMBootConfig, d *schema.ResourceData) (*v3.VMBootConfig, bool) {
hotPlugChange := false

bootConfig := &v3.VMBootConfig{}
if boot != nil {
*bootConfig = *boot
}

if d.HasChange("boot_device_order_list") {
_, n := d.GetChange("boot_device_order_list")
boot.BootDeviceOrderList = expandStringList(n.([]interface{}))
bootConfig.BootDeviceOrderList = expandStringList(n.([]interface{}))
hotPlugChange = false
}

if d.HasChange("boot_type") {
_, n := d.GetChange("boot_type")
boot.BootType = utils.StringPtr(n.(string))
bootConfig.BootType = utils.StringPtr(n.(string))
hotPlugChange = false
}

Expand All @@ -1284,13 +1289,13 @@ func bootConfigHasChange(boot *v3.VMBootConfig, d *schema.ResourceData) (*v3.VMB
bd.MacAddress = utils.StringPtr(n.(string))
hotPlugChange = false
}
boot.BootDevice = bd
bootConfig.BootDevice = bd

if dska.AdapterType == nil && dska.DeviceIndex == nil && bd.MacAddress == nil {
boot.BootDevice = nil
bootConfig.BootDevice = nil
}

return boot, hotPlugChange
return bootConfig, hotPlugChange
}

func changePowerState(ctx context.Context, conn *v3.Client, id string, powerState string) error {
Expand Down

0 comments on commit 7a6668f

Please sign in to comment.