diff --git a/terraform/main.tf b/terraform/main.tf index aa9764d..549bde1 100644 --- a/terraform/main.tf +++ b/terraform/main.tf @@ -1,28 +1,43 @@ resource "proxmox_virtual_environment_container" "cattle" { for_each = var.lxc_inventory - # 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 + node_name = each.value.node + vm_id = each.key - cores = each.value.cores - memory = each.value.memory - - rootfs { - storage = "local-lvm" - size = each.value.disk_size + initialization { + hostname = each.value.hostname + user_account { + password = var.lxc_root_password + } + ip_config { + ipv4 { + address = each.value.ip + gateway = each.value.gw + } + } } - network { + operating_system { + template_file_id = "local:vztmpl/ubuntu-22.04-standard_22.04-1_amd64.tar.zst" + type = "ubuntu" + } + + cpu { + cores = each.value.cores + } + + memory { + dedicated = each.value.memory + } + + disk { + datastore_id = "local-lvm" + size = tonumber(replace(each.value.disk_size, "G", "")) # Converts "20G" to 20 + } + + network_interface { name = "eth0" bridge = "vmbr0" - ip = each.value.ip - gw = each.value.gw - tag = each.value.vlan + vlan_id = each.value.vlan } } \ No newline at end of file