[x] Is it a bug or something that does not work as expected? Please make sure you fill the version information below:
Description of Issue/Question
When trying to do a very simple setup the creation of a single domain hangs forever. With builds taking over 20 minutes.
This only happens when a cloud-init image is attached to the configuration, otherwise it takes less than 2.
Attaching a cloud-init image works fine on terraform 1.4.6, but hangs on 1.5.0.
Setup
On archlinux with the most recent version of everything (just after a pacman -Syu and reboot)
terraform {
required_version = ">= 0.13"
required_providers {
libvirt = {
source = "dmacvicar/libvirt"
version = "0.7.1"
}
}
}
# instance the provider
provider "libvirt" {
uri = "qemu:///system"
}
# We fetch the latest ubuntu release image from their mirrors
resource "libvirt_volume" "rocky9" {
name = "rocky9"
source = "https://download.rockylinux.org/pub/rocky/9/images/x86_64/Rocky-9-GenericCloud.latest.x86_64.qcow2"
format = "qcow2"
}
data "template_file" "user_data" {
template = file("${path.module}/cloud_init.cfg")
}
data "template_file" "network_config" {
template = file("${path.module}/network_config.cfg")
}
# for more info about paramater check this out
# https://github.com/dmacvicar/terraform-provider-libvirt/blob/master/website/docs/r/cloudinit.html.markdown
# Use CloudInit to add our ssh-key to the instance
# you can add also meta_data field
resource "libvirt_cloudinit_disk" "commoninit" {
name = "commoninit.iso"
user_data = data.template_file.user_data.rendered
network_config = data.template_file.network_config.rendered
}
# Create the machine
resource "libvirt_domain" "domain-rocky9" {
name = "rocky9-terraform"
memory = "2048"
vcpu = 2
cloudinit = libvirt_cloudinit_disk.commoninit.id
network_interface {
network_name = "default"
wait_for_lease = true
}
cpu {
mode = "host-passthrough"
}
# IMPORTANT: this is a known bug on cloud images, since they expect a console
# we need to pass it
# https://bugs.launchpad.net/cloud-images/+bug/1573095
console {
type = "pty"
target_port = "0"
target_type = "serial"
}
console {
type = "pty"
target_type = "virtio"
target_port = "1"
}
disk {
volume_id = libvirt_volume.rocky9.id
}
graphics {
type = "vnc"
autoport = true
}
}
System Information
Archlinux latest using libvirt 9.4.0
Linux distribution
Archlinux
Version information
Checklist
Description of Issue/Question
When trying to do a very simple setup the creation of a single domain hangs forever. With builds taking over 20 minutes. This only happens when a cloud-init image is attached to the configuration, otherwise it takes less than 2.
Attaching a cloud-init image works fine on terraform
1.4.6
, but hangs on1.5.0
.Setup
On archlinux with the most recent version of everything (just after a
pacman -Syu
and reboot)cloud_init.cfg:
network_config.cfg
Steps to Reproduce Issue
Using the platform and the provided TF file,
Debug log:
AS this never completes I've truncated it at the 1 min mark
Additional information:
Do you have SELinux or Apparmor/Firewall enabled? Some special configuration? Nope, just stock standard arch
Have you tried to reproduce the issue without them enabled? N/A