I'm just getting started using Terraform to create LXC on my Proxmox nodes, so this is probably down to permissions.
When I use the following Terraform plan to create an LXC, I get an error saying only root can create arbitrary filesystems, however, the provider docs state that a rootfs must be supplied to avoid Terraform crashing. The plan is:
The error I get is
When I use the following Terraform plan to create an LXC, I get an error saying only root can create arbitrary filesystems, however, the provider docs state that a rootfs must be supplied to avoid Terraform crashing. The plan is:
Code:
terraform {
required_providers {
proxmox = {
source = "telmate/proxmox"
version = "2.7.4"
}
}
}
provider "proxmox" {
pm_api_url = var.pm_api_url
pm_api_token_id = var.pm_api_token_id
pm_api_token_secret = var.pm_api_token_secret
pm_tls_insecure = true
}
resource "proxmox_lxc" "wireguard" {
hostname = var.hostname
ostemplate = var.template_name
target_node = var.proxmox_node
unprivileged = false
ssh_public_keys = var.ssh_key
rootfs {
storage = "local-lvm"
size = "2G"
}
network {
name = "eth0"
bridge = "vmbr0"
ip = var.ipv4_address
gw = var.gw
}
}
Code:
│ Error: Error creating LXC container: 500 Only root can pass arbitrary filesystem paths. at /usr/share/perl5/PVE/Storage.pm line 486., error status: {"data":null} (params: {"arch":"amd64","cmode":"tty","console":true,"cpulimit":0,"cpuunits":1024,"features":"","hostname":"wireguard","memory":512,"net0":"gw=<redacted>,ip=<redacted>,bridge=vmbr0,name=eth0","onboot":false,"ostemplate":"debian-10-turnkey-wireguard_16.2-1_amd64.tar.gz","protection":false,"rootfs":"local-lvm:2","ssh-public-keys":<redacted>,"start":false,"storage":"local","swap":512,"tags":"","tty":2,"unprivileged":false,"vmid":111})
│
│ with proxmox_lxc.wireguard,
│ on main.tf line 23, in resource "proxmox_lxc" "wireguard":
│ 23: resource "proxmox_lxc" "wireguard" {
│
Last edited: