srb3 / terraform-libvirt-domain

MIT License
1 stars 2 forks source link

commoninit does not work with pool name other than "default" #7

Closed tuxpeople closed 2 years ago

tuxpeople commented 3 years ago

Hi

Sorry to bother you again...

This works:

module "my_pool" {
  source = "srb3/pool/libvirt"
  name   = "default"
  path   = "/data/virt/pools/kvm_tf_pool"
}

module "my-domain" {
  source     = "srb3/domain/libvirt"
  os_name    = "ubuntu"
  os_version = "20.10"
  memory     = 2048
  vcpu       = 2
  autostart  = true
  network    = "${var.location}-tf"
  user_cloudinit = templatefile("./templates/cloud_init.cfg", {
    hostname       = "tf-kvm-test"
    user           = "ansible"
    ssh_public_key = chomp(file("~/.ssh/id_rsa.pub"))
  })
}

With an specific poolname like this, it doesnt work:

module "my_pool" {
  source = "srb3/pool/libvirt"
  name   = "tuxpeople"
  path   = "/data/virt/pools/kvm_tf_pool"
}

module "my-domain" {
  source     = "srb3/domain/libvirt"
  os_name    = "ubuntu"
  os_version = "20.10"
  memory     = 2048
  vcpu       = 2
  autostart  = true
  pool       = "tuxpeople"
  network    = "${var.location}-tf"
  user_cloudinit = templatefile("./templates/cloud_init.cfg", {
    hostname       = "tf-kvm-test"
    user           = "ansible"
    ssh_public_key = chomp(file("~/.ssh/id_rsa.pub"))
  })
}

Error: Bildschirmfoto 2021-10-04 um 13 48 24

I'll send a PR in a minute :-)

Br Thomas