I am facing an error while attempting to create a Windows Server 2022 virtual machine (VM) using Terraform. The error occurs when trying to clone from a Server 2022 VM template in SDDC VMC. The specific error message states: “cannot find OS family for guest ID ‘windows2019svrNext_64Guest’: could not find guest ID ‘windows2019svrNext_64Guest’.”
It seems that Terraform is using the default configuration of the datacenter instead of honoring the explicit hardware version.
However, I can successfully create a VM with the guest ID using PowerCLI in the same environment. Explicitly using -HardwareVersion allows the creation of the vm.
Here is the resource link for vsphere_virtual_machine: Terraform Registry
I am experiencing the exact same issue with an on-premise ESX, and I resolved it by changing the ‘default compatibility’ to ‘Use datacenter setting and host version’.
This situation falls into a ‘grey area’ because VMware (email trail below) might be supporting backward compatibility within SDDC, for reasons beyond our control. Their suggestion is to use the PowerCLI workaround.
A similar issue has been reported earlier: https://github.com/hashicorp/terraform-provider-vsphere/issues/1682
Anyone else having this issue and able to workaround it?