$ cat providers.tf resource "libvirt_volume" "os_image_ubuntu" { name = "os_image_ubuntu" pool = "default" #source = "https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img" source = "./bionic-server-cloudimg-amd64.img" format = "qcow2" } resource "libvirt_volume" "volume" { name = "volume-${count.index}" base_volume_id = libvirt_volume.os_image_ubuntu.id pool = "default" size = 34359738368 count = 2 } data "template_file" "user_data" { template = file("${path.module}/cloud_init.cfg") } resource "libvirt_cloudinit_disk" "cloudinit_ubuntu_resized" { name = "cloudinit_ubuntu_resized.iso" user_data = data.template_file.user_data.rendered pool = "default" } resource "libvirt_domain" "ubuntu" { name = "ubuntu-${count.index}" memory = "2048" vcpu = 2 cpu { mode = "host-passthrough" } cloudinit = libvirt_cloudinit_disk.cloudinit_ubuntu_resized.id network_interface { network_name = "default" wait_for_lease = true } count = 2 console { type = "pty" target_port = "0" target_type = "serial" } console { type = "pty" target_type = "virtio" target_port = "1" } disk { volume_id = element(libvirt_volume.volume.*.id, count.index) } graphics { type = "spice" listen_type = "address" autoport = true } } output "ip" { value = libvirt_domain.ubuntu.*.network_interface.0.addresses }