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" {
|
module "pve_vm" {
|
||||||
source = "../../modules/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
|
node_name = each.value
|
||||||
vm_name = "${each.value}-vm"
|
vm_name = "${each.value}-vm"
|
||||||
vm_cpu = 2
|
vm_cpu = 2
|
||||||
@ -8,6 +8,8 @@ module "pve_vm" {
|
|||||||
vm_vlan = 66
|
vm_vlan = 66
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data "proxmox_virtual_environment_nodes" "pve_nodes" {}
|
||||||
|
|
||||||
output "vm_ip" {
|
output "vm_ip" {
|
||||||
value = { for k, v in module.pve_vm : "${k}-vm" => v.vm_ip }
|
value = { for k, v in module.pve_vm : "${k}-vm" => v.vm_ip }
|
||||||
}
|
}
|
@ -8,9 +8,3 @@ variable "proxmox_api_token" {
|
|||||||
type = string
|
type = string
|
||||||
sensitive = true
|
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