terraform-provider-proxmox: Creating lxc container: "error 500 no such resource"

Im trying to create an lxc container on a proxmox 7.1-5:

terraform {
  required_providers {
    proxmox = {
      source  = "telmate/proxmox"
      version = ">=2.9.1"
    }
  }
}

provider "proxmox" {
  pm_tls_insecure = true
  pm_api_url      = "https://myip:8006/api2/json"
  pm_password     = "password"
  pm_user         = "terraform-prov@pve"
}

resource "proxmox_lxc" "lxc-test" {
  count = 1
  features {
    nesting = true
  }

  // Terraform will crash without rootfs defined
  rootfs {
    storage = "local-zfs"
    size    = "8G"
  }

  hostname = "tf-new"
  network {
    name   = "eth0"
    bridge = "vmbr0"
    ip     = "dhcp"
    ip6    = "dhcp"
  }
  ostemplate = local:vztmpl/ubuntu-21.04-standard_21.04-1_amd64.tar.gz
  password   = "rootroot"
  target_node  = "host1"
  unprivileged = true
}

The container gets created, but it seems it can’t get the containers state?:

proxmox_lxc.lxc-test[0]: Creating...
proxmox_lxc.lxc-test[0]: Still creating... [10s elapsed]
proxmox_lxc.lxc-test[0]: Still creating... [20s elapsed]
╷
│ Error: 500 no such resource 'ct:111'
│
│   with proxmox_lxc.lxc-test[0],
│   on main.tf line 20, in resource "proxmox_lxc" "lxc-test":
│   20: resource "proxmox_lxc" "lxc-test" {
│

I tried also with using root@pam, but the same issue appears.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15

Most upvoted comments

@briandipalma nevermind the go.mod was not updated in my last PR, my bad. fyi the problem was in the api library, not in the provider, and yes it wil be a little slower now due to check for ha state of containers, if present

@ggongaware please bump to 2.9.3 as soon as you can 😃

this worked for me after downgrading to 2.8.0.