From 1fa6ca809760634500d82d392ceb2f336afc7570 Mon Sep 17 00:00:00 2001 From: Kenneth Chu Date: Mon, 8 Mar 2021 18:16:00 -0500 Subject: [PATCH] Fix compare for VM Config spec change --- vsphere/virtual_machine_config_structure.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/vsphere/virtual_machine_config_structure.go b/vsphere/virtual_machine_config_structure.go index fd3b74e9f..61fba4eb1 100644 --- a/vsphere/virtual_machine_config_structure.go +++ b/vsphere/virtual_machine_config_structure.go @@ -916,15 +916,17 @@ func expandVirtualMachineConfigSpecChanged(d *schema.ResourceData, client *govmo log.Printf("[DEBUG] %s: Expanding of old config complete", resourceVSphereVirtualMachineIDString(d)) newSpec, err := expandVirtualMachineConfigSpec(d, client) - // Don't include the hardware version in the UpdateSpec. It is only needed - // when created new VMs. - newSpec.Version = "" if err != nil { return types.VirtualMachineConfigSpec{}, false, err } + isVMConfigSpecChanged := !reflect.DeepEqual(oldSpec, newSpec) + // Don't include the hardware version in the UpdateSpec. It is only needed + // when creating new VMs. + newSpec.Version = "" + // Return the new spec and compare - return newSpec, !reflect.DeepEqual(oldSpec, newSpec), nil + return newSpec, isVMConfigSpecChanged, nil } // getMemoryReservationLockedToMax determines if the memory_reservation is not