From f19741624d5306c309b609fcec2b8de7c497885f Mon Sep 17 00:00:00 2001 From: admin Date: Wed, 28 Jan 2026 14:26:04 -0700 Subject: [PATCH] revise for vars --- terraform/main.tf | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/terraform/main.tf b/terraform/main.tf index 55753bc..c660cc3 100644 --- a/terraform/main.tf +++ b/terraform/main.tf @@ -1,20 +1,28 @@ -#test of gitea runner -resource "proxmox_virtual_environment_container" "managed_lxc" { - node_name = var.target_node - vm_id = var.lxc_id +resource "proxmox_lxc" "cattle" { + for_each = var.lxc_inventory - initialization { - hostname = var.lxc_hostname - ip_config { - ipv4 { - # We can even variablize the IP if you want! - address = "172.16.201.${var.lxc_id}/24" - gateway = "172.16.201.1" - } - } + # Now it looks at the 'node' value for each specific LXC + target_node = each.value.node + + hostname = each.value.hostname + vmid = each.key + ostemplate = "local:vztmpl/ubuntu-22.04-standard_22.04-1_amd64.tar.zst" + password = var.lxc_root_password + unprivileged = true + + cores = each.value.cores + memory = each.value.memory + + rootfs { + storage = "local-lvm" + size = each.value.disk_size } - clone { - vm_id = var.source_template_id + network { + name = "eth0" + bridge = "vmbr0" + ip = each.value.ip + gw = each.value.gw + tag = each.value.vlan } } \ No newline at end of file