talos icon indicating copy to clipboard operation
talos copied to clipboard

No firmware found when deploying ova in vSphere with Terraform

Open tuxpeople opened this issue 1 year ago • 5 comments

Bug Report

Description

I don't think this is a duplicate of #8672 or #8148. But also affecting vSphere.

I'm trying to set up the whole stuff with Terraform. For this, I'm using https://github.com/siderolabs/talos/releases/download/v1.7.2/vmware-amd64.ova. But Terraform complains to be unable to detect the firmware of the image.

This is the part where the error happens:

[...]
data "vsphere_ovf_vm_template" "main" {
  count             = local.copyovf_count
  name              = "main"
  disk_provisioning = "thin"
  datastore_id      = data.vsphere_datastore.main[count.index].id
  remote_ovf_url    = var.ovf_url
  resource_pool_id  = data.vsphere_resource_pool.main[count.index].id
  host_system_id    = data.vsphere_host.main[count.index].id
  ovf_network_map = {
    "VM Network" = data.vsphere_network.main[count.index].id
  }
}

resource "vsphere_virtual_machine" "ovf" {
  count = local.copyovf_count

  resource_pool_id = data.vsphere_compute_cluster.main[count.index].resource_pool_id
  datastore_id     = data.vsphere_datastore.main[count.index].id
  folder           = var.folder
  host_system_id   = data.vsphere_host.main[count.index].id
  datacenter_id    = data.vsphere_datacenter.main[count.index].id

  name              = (var.instances_count == "1" ? "${var.hostname}" : "${format("${var.hostname}%02s", (count.index + 1))}")
  num_cpus          = var.vCPU
  memory            = var.vMEM
  guest_id          = data.vsphere_ovf_vm_template.main[count.index].guest_id
  firmware          = data.vsphere_ovf_vm_template.main[count.index].firmware
  scsi_type         = data.vsphere_ovf_vm_template.main[count.index].scsi_type
  nested_hv_enabled = data.vsphere_ovf_vm_template.main[count.index].nested_hv_enabled
  tags              = var.tag_ids != null ? var.tag_ids : data.vsphere_tag.tag[*].id

  cdrom {
    client_device = true
  }

  dynamic "network_interface" {
    for_each = data.vsphere_ovf_vm_template.main[count.index].ovf_network_map
    content {
      network_id = network_interface.value
    }
  }

  wait_for_guest_ip_timeout = 0

  disk {
    label            = "disk0"
    size             = var.disksize
    eagerly_scrub    = var.eagerly_scrub
    thin_provisioned = var.thin_provisioned
  }

  ovf_deploy {
    allow_unverified_ssl_cert = false
    remote_ovf_url            = data.vsphere_ovf_vm_template.main[count.index].remote_ovf_url
    disk_provisioning         = var.thin_provisioned == true ? "thin" : null
    ovf_network_map           = data.vsphere_ovf_vm_template.main[count.index].ovf_network_map
  }
[...]

Same code works with the Ubuntu ova: https://cloud-images.ubuntu.com/releases/24.04/release/ubuntu-24.04-server-cloudimg-amd64.ova

Logs

Planning failed. Terraform encountered an error while generating this plan.

│ Error: expected firmware to be one of [bios efi], got 
│ 
│   with module.talos-vm.vsphere_virtual_machine.ovf[0],
│   on modules/vsphere_ubuntu_vm/main.tf line 81, in resource "vsphere_virtual_machine" "ovf":
│   81:   firmware          = data.vsphere_ovf_vm_template.main[count.index].firmware

Environment

  • Terraform v1.8.4 on linux_amd64

tuxpeople avatar May 25 '24 08:05 tuxpeople