terraform-provider-vsphere: Cannot find OS family for guest ID `windows2019srvNext_64Guest`

Community Guidelines

  • I have read and agree to the HashiCorp Community Guidelines .
  • Vote on this issue by adding a 👍 reaction to the original issue initial description to help the maintainers prioritize.
  • Do not leave “+1” or other comments that do not add relevant information or questions.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Terraform

v1.2.3

Terraform Provider

2.2.0

VMware vSphere

7.0.2.00000

Description

Unable to create Windows Server 2022 VM via Terraform.

Affected Resources

resourse/vsphere_virtual_machine

Terraform Configuration

terraform {
  required_providers {
    vsphere = {
      source = "hashicorp/vsphere"
      version = "2.2.0"
    }
  }
}

provider "vsphere" {
  user                 = var.vsphere_user
  password             = var.vsphere_password
  vsphere_server       = var.vsphere_server
  allow_unverified_ssl = true
}

data "vsphere_datacenter" "datacenter" {
  name = "datacenter1"
}

data "vsphere_datastore" "datastore" {
  name          = "vsanDatastore"
  datacenter_id = data.vsphere_datacenter.datacenter.id
}

data "vsphere_compute_cluster" "cluster" {
  name          = "cluster1"
  datacenter_id = data.vsphere_datacenter.datacenter.id
}

data "vsphere_virtual_machine" "template" {
  name          = var.esxi-vm-template-names.win2022
  datacenter_id = data.vsphere_datacenter.datacenter.id
}

data "vsphere_distributed_virtual_switch" "DSwitch" {
  name          = "DSwitch"
  datacenter_id = data.vsphere_datacenter.datacenter.id
}

resource "vsphere_distributed_port_group" "VLAN4" {
  name                            = "VLAN 4"
  distributed_virtual_switch_uuid = data.vsphere_distributed_virtual_switch.DSwitch.id
}

resource "vsphere_virtual_machine" "esxi-vm" {
    name             = var.computer_name
    resource_pool_id = data.vsphere_compute_cluster.cluster.resource_pool_id
    datastore_id     = data.vsphere_datastore.datastore.id
    num_cpus         = var.num_cpus
    memory           = var.memory
    tags = ["${vsphere_tag.tag.id}"]
    guest_id         = data.vsphere_virtual_machine.template.guest_id
    
    network_interface {
         network_id   = vsphere_distributed_port_group.VLAN4.id
    }

    disk {
        label            = "Disk-OS-${var.computer_name}"
        size             = data.vsphere_virtual_machine.template.disks.0.size
        thin_provisioned = data.vsphere_virtual_machine.template.disks.0.thin_provisioned
    }

    clone {
        template_uuid=data.vsphere_virtual_machine.template.id
        customize {
            windows_options {
                computer_name = var.computer_name
                admin_password = var.admin_password 
                join_domain = var.join_domain
                domain_admin_user = var.domain_admin_user
                domain_admin_password = var.domain_admin_password
                full_name = var.full_name
                organization_name = var.organization_name
            }
        }
    }
}

Debug Output

No response

Panic Output

No response

Expected Behavior

Create Windows Server 2022 VM from template.

Actual Behavior

data.vsphere_datacenter.datacenter: Reading...
data.vsphere_datacenter.datacenter: Read complete after 0s [id=datacenter-135]
data.vsphere_compute_cluster.cluster: Reading...
data.vsphere_distributed_virtual_switch.DSwitch: Reading...
data.vsphere_datastore.datastore: Reading...
data.vsphere_virtual_machine.template: Reading...
data.vsphere_datastore.datastore: Read complete after 1s [id=datastore-10589]
data.vsphere_compute_cluster.cluster: Read complete after 2s [id=domain-c1558]
data.vsphere_distributed_virtual_switch.DSwitch: Read complete after 2s [id=50 3a d3 00 9e de a6 bc-01 1a a1 15 46 ee 72 71]
data.vsphere_virtual_machine.template: Read complete after 2s [id=423a3d72-c679-53a6-2a1c-31c44a18b738]
╷
│ Error: cannot find OS family for guest ID "windows2019srvNext_64Guest": could not find guest ID "windows2019srvNext_64Guest"
│ 
│   with vsphere_virtual_machine.esxi-vm,
│   on vmware_vm.tf line 3, in resource "vsphere_virtual_machine" "esxi-vm":
│    3: resource "vsphere_virtual_machine" "esxi-vm" {
│ 
╵

Steps to Reproduce

  1. Manually create Windows Server 2022 VM and clone it to template
  2. run terraform apply

Environment Details

No response

Screenshots

No response

References

https://vdc-download.vmware.com/vmwb-repository/dcr-public/bf660c0a-f060-46e8-a94d-4b5e6ffc77ad/208bc706-e281-49b6-a0ce-b402ec19ef82/SDK/vsphere-ws/docs/ReferenceGuide/vim.vm.GuestOsDescriptor.GuestOsIdentifier.html

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17

Most upvoted comments

Hi @SemenAnikin - could you please format the plan configuration and console outputs in the issue content for readability?

Ryan Johnson Staff II Solutions Architect | VMware, Inc.

Hi @tenthirtyam, does it meet requirements now?