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:
24
terraform/outputs.tf
Normal file
24
terraform/outputs.tf
Normal file
@@ -0,0 +1,24 @@
|
||||
# Dynamic outputs for all deployed VMs
|
||||
|
||||
output "vm_ips" {
|
||||
description = "IP addresses and SSH commands for deployed VMs"
|
||||
value = {
|
||||
for name, vm in proxmox_vm_qemu.vm : name => {
|
||||
ip = vm.default_ipv4_address
|
||||
ssh_command = "ssh root@${vm.default_ipv4_address}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
output "deployment_summary" {
|
||||
description = "Summary of deployed VMs with their specifications"
|
||||
value = {
|
||||
for name, vm in proxmox_vm_qemu.vm : name => {
|
||||
cpu_cores = vm.cpu[0].cores
|
||||
memory_mb = vm.memory
|
||||
disk_size = vm.disks[0].virtio[0].virtio0[0].disk[0].size
|
||||
ip = vm.default_ipv4_address
|
||||
node = vm.target_node
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user