Skip to content

Importing LXC container does not import unprivileged flag value #1787

Open
@Renerick

Description

@Renerick

Describe the bug
Importing LXC container does not import unprivileged flag value, so when trying to update the container, it is forced to be recreated

To Reproduce
Steps to reproduce the behavior:

  1. Create a container with unprivileged = true
  2. Remove the state
  3. Import the container back to (terraform import)
  4. Run terraform plan
  5. See error of terraform wanting to replace the container because of unprivileged field

Note: there are other fields that are not imported too, such as user password, keys and container template file name. As far as I understand, there is no way to get those fields from proxmox API, so no questions here.

Please also provide a minimal Terraform configuration that reproduces the issue.

resource "proxmox_virtual_environment_container" "ubuntu_container" {
  vm_id     = 9876

  node_name = "pve-1"
  unprivileged = true

  features {
    nesting = true
  }

  initialization {
    hostname = "repro"

    ip_config {
      ipv4 {
        address = "10.0.0.2/16"
        gateway = "10.0.0.1"
      }
    }

    user_account {
      password = "pwdpwd"
    }
  }

  network_interface {
    name = "eth0"
  }

  disk {
    size = 4
    // put your disk in here
  }

  cpu {
    cores = 1
  }

  operating_system {
    template_file_id = "local:vztmpl/ubuntu-24.10-standard_24.10-1_amd64.tar.zst"
    type             = "ubuntu"
  }
}

and the output of terraform|tofu apply.

...
unprivileged   = true # forces replacement
...

Expected behavior
Unprivileged value is imported correctly

Screenshots
If applicable, add screenshots to help explain your problem.

N/A

Additional context
Add any other context about the problem here.

  • Single or clustered Proxmox: single node
  • Proxmox version: Virtual Environment 8.3.4
  • Provider version (ideally it should be the latest version): 0.72.0
  • Terraform/OpenTofu version:
    Terraform v1.10.5
    on windows_amd64
    
  • OS (where you run Terraform/OpenTofu from): Windows 10 x64
  • Debug logs (TF_LOG=DEBUG terraform apply):

Metadata

Metadata

Assignees

No one assigned

    Projects

    • Status

      📥 Inbox

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions