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>
25 lines
675 B
HCL
25 lines
675 B
HCL
# 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
|
|
}
|
|
}
|
|
}
|