resource "proxmox_virtual_environment_container" "lxc_test" {
  node_name    = var.node
  vm_id        = var.vmid
  unprivileged = true

  description = "Terraform test LXC - Phase 1 (${var.hostname})"

  cpu {
    cores = var.cores
  }

  memory {
    dedicated = var.memory
  }

  disk {
    datastore_id = var.storage
    size         = var.rootfs_size
  }

  network_interface {
    name   = "eth0"
    bridge = "vmbr0"
  }

  features {
    nesting = true
  }

  initialization {
    hostname = var.hostname

    dns {
      servers = var.dns_servers
    }

    ip_config {
      ipv4 {
        address = var.ipv4
        gateway = var.gateway
      }
    }

    user_account {
      keys     = [file(var.ssh_key_path)]
      password = var.password
    }
  }

  operating_system {
    template_file_id = var.template_file_id
    type             = "debian"
  }

  tags = ["terraform", "phase1", "test"]
}
