Versions
Terraform v0.11.10
Fedora 29
terraform-provider-libvirt -version:
Compiled against library: libvirt 4.7.0
Using library: libvirt 4.7.0
Running hypervisor: QEMU 3.0.0
Running against daemon: 4.7.0
git describe --always --abbrev=40 --dirty
1854aa93f614b0dfc54d5670bb27e9ac6bbda039
Terraform fails with
Error: libvirt_cloudinit_disk.commoninit: Provider doesn't support resource: libvirt_cloudinit_disk
(Please provide the full main.tf file for reproducing the issue (Be sure to remove sensitive info)
provider "libvirt" {
uri = "qemu:///system"
}
resource "libvirt_volume" "os_image" {
name = "os_image"
source = "/opt/images/alpine-virt-3.8.1-x86_64.qcow2"
}
resource "libvirt_volume" "volume" {
name = "volume-${count.index}"
base_volume_id = "${libvirt_volume.os_image.id}"
count = 20
}
data "template_file" "user_data" {
template = "${file("${path.module}/cloud_init.cfg")}"
}
data "template_file" "network_config" {
template = "${file("${path.module}/network_config.cfg")}"
}
resource "libvirt_cloudinit_disk" "commoninit" {
name = "commoninit.iso"
user_data = "${data.template_file.user_data.rendered}"
network_config = "${data.template_file.network_config.rendered}"
}
resource "libvirt_domain" "domain" {
name = "Alpine-linux-${count.index}"
memory = 256
vcpu = 1
disk {
volume_id = "${element(libvirt_volume.volume.*.id, count.index)}"
}
network_interface {
network_name = "default"
wait_for_lease = true
}
count = 20
}
output "ips" {
value = "${libvirt_domain.domain.*.network_interface.0.addresses}"
}
(Include debug logs if possible and relevant.)
go get the source
go install
link to .terraform /plugins
run ubuntu example fails with error message above
custom .tf also fails, included above
Do you have SELinux or Apparmor/Firewall enabled? Some special configuration?
Have you tried to reproduce the issue without them enabled?
yes, using
setenforce 0
Can you update your provider? I just tested that example.and it works. The error you have is because the old api :)
You should also run terraform init for init the providers once you have the provider kvm in bin
Can confirm that issue was the old API, now the example works, thanks
@mtuvikene thx for feedback enjoy the day ,
Hi, I have followed the ubuntu/example but failed. I don't know why the downloaded ubuntu-qcow2 is owned by root:root. So after I run terraform apply, it failed with "permission denied"
total 284M
-rw-r--r-- 1 libvirt-qemu kvm 366K Dec 20 15:14 commoninit.iso
-rw-r--r-- 1 root root 284M Dec 20 15:15 ubuntu-qcow2
I use Ubuntu-18.04.1 and terraform is v0.11.11.
@MalloZup
1 error(s) occurred:
* libvirt_domain.vm1: 1 error(s) occurred:
* libvirt_domain.vm1: Error creating libvirt domain: virError(Code=1, Domain=10, Message='internal error: process exited while connecting to monitor: 2018-12-20T08:11:59.323604Z qemu-system-x86_64: -drive file=/var/lib/libvirt/images/ubuntu-qcow2,format=qcow2,if=none,id=drive-virtio-disk0: Could not open '/var/lib/libvirt/images/ubuntu-qcow2': Permission denied')
set security_driver = "none" in /etc/libvirt/qemu.conf then reload config and restart libvirtd. It works.