Deploy LXC containers
terraform/proxmox/lxc creates LXC containers in Proxmox using the proxmox/lxc module from Brsalcedom/tf-modules.
Prerequisites
Section titled “Prerequisites”- Your shell has the variables listed in Environment variables.
- The OS template is downloaded on the node.
Download the container template
Section titled “Download the container template”In the Proxmox UI go to Node → local → CT Templates → Templates and download the template set in defaults.template in locals.tf (currently debian-13-standard_13.6-1_amd64.tar.zst).
Add a container
Section titled “Add a container”Containers are declared in the containers map in terraform/proxmox/lxc/locals.tf. Any key you leave out falls back to defaults.
containers = { # ... "my-container" = { description = "My container | IP: 192.168.10.180" ip = "192.168.10.180" id = 180 cpu = 4 # optional, default 2 memory = 4096 # optional, default 2048 disk = 30 # optional, default 15 (GB) tags = ["example"] }}Other optional keys: template, unprivileged (default true) and mountpoint (passed to the module as nas_mountpoint).
The target node comes from the node_name variable (default prox). Override it with TF_VAR_node_name.
Apply the change
Section titled “Apply the change”Through CI: merge to main; the Tofu :: Proxmox LXC workflow plans and applies.
From your workstation:
cd terraform/proxmox/lxctofu inittofu plantofu applyCheck the result
Section titled “Check the result”ssh root@<container-ip>Then confirm CPU, memory, disk, tags, description and network settings in the Proxmox UI.
See Terraform: LXC for the inputs and modules of this configuration.