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
This commit is contained in:
Lukas Greve
2025-09-18 20:24:38 +02:00
parent 75b2ae6b40
commit 902420a3ea
6 changed files with 18 additions and 4 deletions

View File

@@ -3,7 +3,9 @@ resource "libvirt_domain" "domain" {
name = "${var.vm_name}-${count.index}"
memory = var.memory
vcpu = var.vcpu
cloudinit = libvirt_cloudinit_disk.commoninit.id
# Only include cloudinit if enabled
cloudinit = var.enable_cloudinit ? libvirt_cloudinit_disk.commoninit[count.index].id : null
# ---- optional UEFI support ------------------------------------
# Firmware only add the string when a path is supplied