terraform: add parameterized multi-VM deployment system
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>
This commit is contained in:
@@ -20,3 +20,78 @@ variable "proxmox_tls_insecure" {
|
||||
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"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user