## Examples ### Basic example ```hcl resource "proxmox_lxc" "basic" { target_node = "pve" hostname = "lxc-basic" ostemplate = "local:vztmpl/ubuntu-20.04-standard_20.04-1_amd64.tar.gz" password = "BasicLXCContainer" unprivileged = true // Terraform will crash without rootfs defined rootfs { storage = "local-zfs" size = "8G" } network { name = "eth0" bridge = "vmbr0" ip = "dhcp" } } ``` ### Multiple mount points -> By specifying `local-lvm:12` for the `mountpoint.storage` attribute in the first `mountpoint` block below, a volume will be automatically created for the LXC container. For more information on this behavior, see [Storage Backed Mount Points](https://pve.proxmox.com/pve-docs/pve-admin-guide.html#_storage_backed_mount_points). ```hcl resource "proxmox_lxc" "multiple_mountpoints" { target_node = "pve" hostname = "lxc-multiple-mountpoints" ostemplate = "local:vztmpl/ubuntu-20.04-standard_20.04-1_amd64.tar.gz" unprivileged = true ostype = "ubuntu" ssh_public_keys = <<-EOT ssh-rsa <public_key_1> [email protected] ssh-ed25519 <public_key_2> [email protected] EOT // Terraform will crash without rootfs defined rootfs { storage = "local-zfs" size = "8G" } // Storage Backed Mount Point mountpoint { key = "0" slot = 0 storage = "local-lvm" mp = "/mnt/container/storage-backed-mount-point" size = "12G" } // Bind Mount Point mountpoint { key = "1" slot = 1 storage = "/srv/host/bind-mount-point" // Without 'volume' defined, Proxmox will try to create a volume with // the value of 'storage' + : + 'size' (without the trailing G) - e.g. // "/srv/host/bind-mount-point:256". // This behaviour looks to be caused by a bug in the provider. volume = "/srv/host/bind-mount-point" mp = "/mnt/container/bind-mount-point" size = "256G" } // Device Mount Point mountpoint { key = "2" slot = 2 storage = "/dev/sdg" volume = "/dev/sdg" mp = "/mnt/container/device-mount-point" size = "32G" } network { name = "eth0" bridge = "vmbr0" ip = "dhcp" ip6 = "dhcp" } } ``` ### LXC with advanced features enabled ```hcl resource "proxmox_lxc" "advanced_features" { target_node = "pve" hostname = "lxc-advanced-features" ostemplate = "local:vztmpl/ubuntu-20.04-standard_20.04-1_amd64.tar.gz" unprivileged = true ssh_public_keys = <<-EOT ssh-rsa <public_key_1> [email protected] ssh-ed25519 <public_key_2> [email protected] EOT features { fuse = true nesting = true mount = "nfs;cifs" } // Terraform will crash without rootfs defined rootfs { storage = "local-zfs" size = "8G" } // NFS share mounted on host mountpoint { slot = "0" storage = "/mnt/host/nfs" mp = "/mnt/container/nfs" size = "250G" } network { name = "eth0" bridge = "vmbr0" ip = "10.0.0.2/24" ip6 = "auto" } } ``` ### Clone basic example ```hcl resource "proxmox_lxc" "basic" { target_node = "pve" hostname = "lxc-clone" #id of lxc container to clone clone = "8001" } ``` ## Sources [terraform-provider-proxmox/docs/resources/lxc.md at master · Telmate/terraform-provider-proxmox · GitHub](https://github.com/Telmate/terraform-provider-proxmox/blob/master/docs/resources/lxc.md)