replace static set with data source for node names
This commit is contained in:
parent
a5e79eaba7
commit
285917f104
@ -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 }
|
||||
}
|
@ -7,10 +7,4 @@ variable "proxmox_api_token" {
|
||||
description = "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"]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user