dmacvicar / terraform-provider-libvirt

Terraform provider to provision infrastructure with Linux's KVM using libvirt
Apache License 2.0
1.59k stars 458 forks source link

coreos_ignition: can't load #775

Open nnachefski opened 4 years ago

nnachefski commented 4 years ago

I'm trying to use libvirt_ignition to stand up an instance for testing.

Terraform = v0.12.24 libvirt tf provider = v0.6.2 KVM = 2.12.0-44

I keep getting this error:

Error: Error creating libvirt domain: virError(Code=1, Domain=10, Message='internal error: qemu unexpectedly closed the monitor: 2020-08-18T20:15:50.321113Z qemu-kvm: -fw_cfg name=opt/com.coreos/config,file=T6OiMr-hJZB-3ctf-yP9I-i6NI-0cSg-KceTis: can't load T6OiMr-hJZB-3ctf-yP9I-i6NI-0cSg-KceTis')

  on main.tf line 47, in resource "libvirt_domain" "master01":
  47: resource "libvirt_domain" "master01" {

Should i be using something other than libvirt_ignition.master_ignition-metal3.id ?

Here is the tf:

provider "libvirt" {
    uri = "qemu:///system"
}

provider "libvirt" {
  alias = "metal3"
  uri   = "qemu+ssh://root@metal3/system"
}

resource "libvirt_volume" "rhcos45-qcow2-metal3" {
  name = "rhcos.qcow2"
  pool = "pool"
  source = "http://repo:8080/assets/rhcos-4.5.2-x86_64-qemu.x86_64.qcow2.gz"
  format = "qcow2"
  provider = libvirt.metal3
}

resource "libvirt_ignition" "master_ignition-metal3" {
  name = "master.ign"
  pool = "pool"  
  content = file("/tmp/master.ign")
  provider = libvirt.metal3
}

# Define KVM domain to create
resource "libvirt_domain" "master01" {
  count = 1

  name   = "master01"
  memory = "16384"
  vcpu   = 4

  network_interface {
    network_name = "default"
    mac = "52:54:00:18:58:01"
  }

  disk {
    volume_id = libvirt_volume.rhcos45-qcow2-metal3.id
  }

  coreos_ignition = libvirt_ignition.master_ignition-metal3.id

  boot_device {
    dev = [ "hd"]
  }  

  console {
    type = "pty"
    target_type = "serial"
    target_port = "0"
  }

  graphics {
    type = "spice"
    listen_type = "address"
    autoport = true
  }

  provider = libvirt.metal3
}

terraform {
  required_version = ">= 0.12"
}
MalloZup commented 4 years ago

:thinking: I dunno I never used the coreos examples.. we might need some coreos community help regarding this,

TheSeubert commented 4 years ago

@nnachefski that is the correct usage

What is pool "pool" on the hypervisor? You should be able to check the location if its is a dir type and see the file "master.ign" with the contents of /tmp/master.ign.

The only difference is that I use ct_config to render a template from a YAML (FCC/CL) and use data.ct_config.controller-ignitions.*.rendered as the content for the libvirt_ignition resource. This renders the files into the default pool which I can see and libvirt boots the qemu machine with -fw_cfg name=opt/com.coreos/config,file=/var/lib/libvirt/images/vm1-ign

MalloZup commented 4 years ago

thx @dude051 for jumping into this. I'm setting to need info of @nnachefski

scabala commented 1 month ago

Hi @nnachefski apart from providing more information, could you try latest version?