Skip to content

vm with uefi resource fail #1239

@dscain

Description

@dscain

When applying this from the examples (https://github.com/dmacvicar/terraform-provider-libvirt/blob/main/examples/resources/libvirt_domain/resource.tf) :

# VM with UEFI firmware
resource "libvirt_domain" "uefi_example" {
  name   = "uefi-vm"
  memory = 4096
  memory_unit   = "MiB"
  vcpu   = 4
  type   = "kvm"

  os = {
    type             = "hvm"
    type_arch        = "x86_64"
    type_machine     = "q35"
    firmware         = "efi"
    loader           = "/usr/share/edk2/x64/OVMF_CODE.secboot.4m.fd"
    loader_readonly  = true
    loader_type      = "pflash"
    nv_ram = {
      nv_ram   = "/var/lib/libvirt/qemu/nvram/uefi-vm.fd"
      template = "/usr/share/edk2/x64/OVMF_VARS.4m.fd"
    }
    boot_devices     = ["hd"]
  }
}

I get

``` Error: Incorrect attribute value type

│   on test.tf line 22, in resource "libvirt_domain" "uefi_example":
│   22:   os = {
│   23:     type             = "hvm"
│   24:     type_arch        = "x86_64"
│   25:     type_machine     = "q35"
│   26:     firmware         = "efi"
│   27:     loader           = "/usr/share/edk2/x64/OVMF_CODE.secboot.4m.fd"
│   28:     loader_readonly  = true
│   29:     loader_type      = "pflash"
│   30:     nv_ram = {
│   31:       nv_ram   = "/var/lib/libvirt/qemu/nvram/uefi-vm.fd"
│   32:       template = "/usr/share/edk2/x64/OVMF_VARS.4m.fd"
│   33:     }
│   34:     boot_devices     = ["hd"]
│   35:   }

│ Inappropriate value for attribute "os": attribute "boot_devices": element 0: object required.

I am running into this error after finding other problems with the EFI in my own custom configuration. Normally I would just create a PR, but I understand there needs to be a discussion ahead? I can just try a PR if ok.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions