Implements Phase 1 of the OpenTofu deployment plan: - Replace single-VM configuration with locals-based for_each pattern - Support multiple VMs in single deployment - Automatic DHCP vs static IP detection - Configurable defaults with per-VM overrides - Dynamic outputs for VM IPs and specifications New files: - outputs.tf: Dynamic outputs for deployed VMs - vms.tf: VM definitions using locals.vms map Updated files: - variables.tf: Added default variables for VM configuration - README.md: Comprehensive documentation and examples Removed files: - vm.tf: Replaced by new vms.tf (archived as vm.tf.old, then removed) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
98 lines
2.3 KiB
HCL
98 lines
2.3 KiB
HCL
variable "proxmox_api_url" {
|
|
description = "Proxmox API URL (e.g., https://proxmox.home.2rjus.net:8006/api2/json)"
|
|
type = string
|
|
}
|
|
|
|
variable "proxmox_api_token_id" {
|
|
description = "Proxmox API Token ID (e.g., root@pam!terraform)"
|
|
type = string
|
|
sensitive = true
|
|
}
|
|
|
|
variable "proxmox_api_token_secret" {
|
|
description = "Proxmox API Token Secret"
|
|
type = string
|
|
sensitive = true
|
|
}
|
|
|
|
variable "proxmox_tls_insecure" {
|
|
description = "Skip TLS verification (set to true for self-signed certs)"
|
|
type = bool
|
|
default = true
|
|
}
|
|
|
|
# Default values for VM configurations
|
|
# These can be overridden per-VM in vms.tf
|
|
|
|
variable "default_target_node" {
|
|
description = "Default Proxmox node to deploy VMs to"
|
|
type = string
|
|
default = "pve1"
|
|
}
|
|
|
|
variable "default_template_name" {
|
|
description = "Default template VM name to clone from"
|
|
type = string
|
|
default = "nixos-25.11.20260128.fa83fd8"
|
|
}
|
|
|
|
variable "default_ssh_public_key" {
|
|
description = "Default SSH public key for root user"
|
|
type = string
|
|
default = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAwfb2jpKrBnCw28aevnH8HbE5YbcMXpdaVv2KmueDu6 torjus@gunter"
|
|
}
|
|
|
|
variable "default_storage" {
|
|
description = "Default storage backend for VM disks"
|
|
type = string
|
|
default = "local-zfs"
|
|
}
|
|
|
|
variable "default_bridge" {
|
|
description = "Default network bridge"
|
|
type = string
|
|
default = "vmbr0"
|
|
}
|
|
|
|
variable "default_vlan_tag" {
|
|
description = "Default VLAN tag"
|
|
type = number
|
|
default = 13
|
|
}
|
|
|
|
variable "default_gateway" {
|
|
description = "Default network gateway for static IP VMs"
|
|
type = string
|
|
default = "10.69.13.1"
|
|
}
|
|
|
|
variable "default_nameservers" {
|
|
description = "Default DNS nameservers"
|
|
type = string
|
|
default = "10.69.13.5 10.69.13.6"
|
|
}
|
|
|
|
variable "default_search_domain" {
|
|
description = "Default DNS search domain"
|
|
type = string
|
|
default = "home.2rjus.net"
|
|
}
|
|
|
|
variable "default_cpu_cores" {
|
|
description = "Default number of CPU cores"
|
|
type = number
|
|
default = 2
|
|
}
|
|
|
|
variable "default_memory" {
|
|
description = "Default memory in MB"
|
|
type = number
|
|
default = 2048
|
|
}
|
|
|
|
variable "default_disk_size" {
|
|
description = "Default disk size"
|
|
type = string
|
|
default = "20G"
|
|
}
|