Files
homelab/terraform/proxmox/vm/variables.tf
2026-05-25 20:21:24 -05:00

157 lines
5.3 KiB
HCL

# ─── Provider Authentication ──────────────────────────────────────────────────
variable "proxmox_api_url" {
type = string
description = "Proxmox API endpoint URL (e.g., https://fantasyland.mk-labs.net:8006)"
}
variable "proxmox_api_token" {
type = string
description = "Proxmox API token in format: user@realm!token-name=token-secret"
sensitive = true
}
# ─── VM Identity ───────────────────────────────────────────────────────────────
variable "vm_id" {
type = number
description = "Proxmox VM ID. Computed by n8n from IP: {third_octet}{fourth_octet:03d} (e.g., 10.1.71.200 → 71200)."
}
variable "hostname" {
type = string
description = "VM hostname. Used as the Proxmox VM name and cloud-init hostname."
}
variable "ip_address" {
type = string
description = "Primary IP address for the VM (without CIDR, e.g., 10.1.71.100). Used for VM ID derivation and DHCP reservation."
}
variable "dns_servers" {
type = list(string)
description = "DNS servers for the VM."
default = ["10.1.71.1"]
}
variable "search_domain" {
type = string
description = "DNS search domain for the VM."
default = "mk-labs.net"
}
# ─── Proxmox Placement ────────────────────────────────────────────────────────
variable "clone_node" {
type = string
description = "Proxmox node where templates live. Cloning always happens here."
default = "fantasyland"
}
variable "target_node" {
type = string
description = "Proxmox node for final VM placement. VM is migrated here after clone."
}
variable "datastore" {
type = string
description = "Proxmox storage pool for VM disks."
default = "liberty-tree"
}
# ─── Template Selection ───────────────────────────────────────────────────────
variable "template_name" {
type = string
description = "Name of the Proxmox VM template to clone."
validation {
condition = contains([
"ubuntu-24.04-small",
"ubuntu-24.04-medium",
"ubuntu-24.04-large",
"ubuntu-24.04-large-plus",
"ubuntu-24.04-xlarge",
"ubuntu-24.04-xlarge-plus",
], var.template_name)
error_message = "template_name must be a valid Ubuntu 24.04 template."
}
}
# ─── Network ──────────────────────────────────────────────────────────────────
variable "vlan_id" {
type = number
description = "VLAN tag for the VM network interface."
default = 71
}
variable "bridge" {
type = string
description = "Proxmox network bridge for the VM."
default = "vmbr0"
}
variable "started" {
type = bool
description = "Whether to start the VM after creation. Pipeline sets false (n8n handles start); manual bootstrap sets true."
default = false
}
variable "use_dhcp" {
type = bool
description = "Use DHCP (pipeline mode) or static IP (bootstrap mode)."
default = true
}
variable "subnet_mask" {
type = number
description = "Subnet mask in CIDR notation (e.g., 24). Only used when use_dhcp = false."
default = 24
}
variable "gateway" {
type = string
description = "Default gateway. Only used when use_dhcp = false."
default = "10.1.71.1"
}
# ─── PCIe Passthrough (optional) ──────────────────────────────────────────────
# When pcie_passthrough_enabled = true, the device at pcie_device_id is passed
# through to the VM. Used for GPU workloads (e.g. astro-orbiter / RX 5700).
# Requires vfio-pci bound on the host and IOMMU enabled.
variable "pcie_passthrough_enabled" {
type = bool
description = "When true, passes through the PCIe device at pcie_device_id to the VM."
default = false
}
variable "pcie_device_id" {
type = string
description = "PCIe device address to pass through (e.g. '0000:03:00'). Get from lspci on the host."
default = ""
}
# ─── Data Disk (optional) ─────────────────────────────────────────────────────
# When data_disk_enabled = true, a second disk is provisioned for application
# data. Ansible handles LVM setup, formatting, and mounting.
variable "data_disk_enabled" {
type = bool
description = "When true, provisions a second disk for application data storage."
default = false
}
variable "data_disk_size" {
type = number
description = "Size of the data disk in GB. Only used when data_disk_enabled = true."
default = 128
}
variable "data_disk_datastore" {
type = string
description = "Proxmox storage pool for the data disk. Defaults to var.datastore when empty."
default = ""
}