Make VMs dynamic with for_each map — spin up/down any number by name

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Ludwig Mey
2026-09-28 20:04:45 +13:00
co-authored by Claude Sonnet 4.6
parent b8ce272610
commit dad5376064
3 changed files with 31 additions and 43 deletions
+9 -7
View File
@@ -1,12 +1,14 @@
# Copy this to terraform.tfvars and fill in your values
# Copy to terraform.tfvars and fill in your values
# terraform.tfvars is gitignored
proxmox_api_token = "terraform@pve!terraform=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
proxmox_api_token = "root@pam!terraform=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
ssh_private_key_path = "~/.ssh/id_ecdsa"
ssh_public_key = "ecdsa-sha2-nistp256 AAAA... luddie@shadowfax"
vm_name = "debian-vm"
vm_id = 100
vm_cores = 2
vm_memory = 2048
vm_disk_size = 20
# Add/remove entries to create/destroy VMs. Key = hostname.
# All fields are optional — defaults: cores=2, memory=2048, disk_size=20
vms = {
"web-1" = {}
"web-2" = {}
"db-1" = { cores = 4, memory = 4096, disk_size = 40 }
}