# Variables # ============ variable "name" { type = string } variable "pool" { type = string default = "default" } variable "userdata" { type = string default = "" } # Main # ============ # Cloud init ISO resource "libvirt_cloudinit_disk" "volume_cloudinit" { name = var.name pool = var.pool user_data = var.userdata } # Outputs # ============ output "volume" { value = libvirt_cloudinit_disk.volume_cloudinit } # ==================== DEPRECATED !!!! # variable "baked_image" { # type = bool # default = true # } # # variable "image_name" { # type = string # } # # variable "image_pool" { # type = string # } # variable "image_dir" { # type = string # } # variable "image_url" { # type = string # } # Deprecated by cloud_volume ! # # Baked volume # resource "libvirt_volume" "volume_system_baked" { # name = "${var.prefix}system.qcow2" # count = var.baked_image ? 1 : 0 # pool = var.pool # # base_volume_name = var.image_name # base_volume_pool = var.image_pool # size = var.disk_size_gb * 1024 * 1024 * 1024 # } # # # Copied volume # resource "libvirt_volume" "volume_system_full" { # name = "${var.prefix}system.qcow2" # count = var.baked_image ? 0 : 1 # pool = var.pool # # #source = var.baked_image ? "" : "${var.image_dir}/${var.image_name}" # source = var.image_url # } # #output "volume_os" { # value = var.baked_image ? resource.libvirt_volume.volume_system_baked[0] : resource.libvirt_volume.volume_system_full[0] #}