Files
advanced-libvirt-terraform-…/multiple/shared_modules/cloud-init.tf
Lukas Greve 902420a3ea Make enabling cloud_init optionnal
For cloud images that needs it, cloud_init can be enabled in the main.tf file. This change will allow deployments that does not require cloud_init to be supported
2025-09-18 20:24:38 +02:00

11 lines
385 B
HCL

# Only create the cloudinit disk if enabled
resource "libvirt_cloudinit_disk" "commoninit" {
count = var.enable_cloudinit ? var.instance_count : 0
name = "${var.cloudinit_filename}-${count.index}"
user_data = templatefile("${path.module}/cloud_init.yaml", {
ssh_key = var.ssh_key
})
pool = "${var.vm_name}-pool"
depends_on = [libvirt_pool.tf_tmp_storage]
}