Files
advanced-libvirt-terraform-…/multiple/shared_modules/variables.tf
2025-09-04 11:30:46 +02:00

113 lines
2.6 KiB
HCL

variable "libvirt_uri" {
description = "URI for libvirt connection"
type = string
default = "qemu:///system"
}
variable "pool_name" {
description = "Name of the storage pool"
type = string
default = "tf_tmp_pool"
}
variable "pool_path" {
description = "Path for the storage pool"
type = string
default = "/tmp/tf_tmp_storage"
}
variable "instance_count" {
description = "Number of instances to create"
type = number
default = 1
}
variable "vm_name" {
description = "Name prefix for VMs"
type = string
}
variable "image_location" {
description = "Location of the OS image"
type = string
default = "https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img"
}
# In order to avoid refetching the cloud ISO each time, it could could be set to a local directory, like : "/var/lib/libvirt/images/noble-server-cloudimg-amd64.img"
# variable "cloudinit_user_data" {
# description = "User data for cloud-init"
# type = string
# default = <<EOF
# #cloud-config
# hostname: ubuntu-cloud-server
# fqdn: ubuntu-cloud-server.tf.local
# EOF
# }
# variable "cloud_init_file" {
# description = "Name of cloud-init config file"
# type = optional(string)
# }
variable "cloudinit_filename" {
description = "Name of the cloud-init ISO file"
type = string
default = "commoninit.iso"
}
variable "user_data" {
description = "User data for cloud-init"
type = string
default = "data.template_file.user_data.rendered"
}
variable "memory" {
description = "Memory allocation in MB"
type = number
default = 2048
validation {
condition = var.memory >= 512
error_message = "Memory must be at least 512MB."
}
}
variable "vcpu" {
description = "Number of virtual CPUs"
type = number
default = 1
}
variable "network_name" {
description = "Name of the network"
type = string
default = "tf"
}
variable "network_mode" {
description = "Network mode (nat, none, route, open, bridge)"
type = string
default = "nat"
}
variable "network_domain" {
description = "Domain name for the network"
type = string
default = "tf.local"
}
variable "network_addresses" {
description = "List of network addresses"
type = list(string)
default = ["10.17.3.0/24", "2001:db8:ca2:2::1/64"]
}
variable "dns_enabled" {
description = "Enable DNS for the network"
type = bool
default = true
}
variable "dns_local_only" {
description = "DNS requests only resolved by virtual network's DNS server"
type = bool
default = false
}