replace static set with data source for node names

This commit is contained in:
Vezpi 2025-03-24 10:31:38 +00:00
parent a5e79eaba7
commit 285917f104
2 changed files with 3 additions and 7 deletions

View File

@ -1,6 +1,6 @@
module "pve_vm" {
source = "../../modules/pve_vm"
for_each = var.node_list
for_each = toset(data.proxmox_virtual_environment_nodes.pve_nodes.names)
node_name = each.value
vm_name = "${each.value}-vm"
vm_cpu = 2
@ -8,6 +8,8 @@ module "pve_vm" {
vm_vlan = 66
}
data "proxmox_virtual_environment_nodes" "pve_nodes" {}
output "vm_ip" {
value = { for k, v in module.pve_vm : "${k}-vm" => v.vm_ip }
}

View File

@ -8,9 +8,3 @@ variable "proxmox_api_token" {
type = string
sensitive = true
}
variable "node_list" {
description = "List of node names in the Proxmox cluster"
type = set(string)
default = ["apex", "vertex", "zenith"]
}