Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compare for VM Config spec change #1361

Merged
merged 1 commit into from
May 7, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions vsphere/virtual_machine_config_structure.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down