0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-08-22 19:38:35 +00:00
terraform-provider-proxmox/docs/data-sources/virtual_environment_containers.md
k69420s 45f28051cd
feat(lxc): add proxmox_virtual_environment_containers data source (#2090)
* feat(lxc): add `proxmox_virtual_environment_containers` data source

- Implements a new data source for fetching container details in Proxmox environments.
- Includes support for filtering by attributes such as name, template, status, and tags.
- Provides documentation and test coverage for the new functionality.

Signed-off-by: k69420s <k69420s@localhost.localdomain>

* suppress duplication error in linter, fix example code

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>

---------

Signed-off-by: k69420s <k69420s@localhost.localdomain>
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
Co-authored-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2025-08-14 18:26:47 -04:00

1.7 KiB

layout title parent subcategory
page proxmox_virtual_environment_containers Data Sources Virtual Environment

Data Source: proxmox_virtual_environment_containers

Retrieves information about all containers in the Proxmox cluster.

Example Usage

data "proxmox_virtual_environment_containers" "ubuntu_containers" {
  tags      = ["ubuntu"]
}

data "proxmox_virtual_environment_containers" "ubuntu_templates" {
  tags      = ["template", "latest"]

  filter {
    name   = "template"
    values = [true]
  }

  filter {
    name   = "status"
    values = ["stopped"]
  }

  filter {
    name   = "name"
    regex  = true
    values = ["^ubuntu-20.*$"]
  }

  filter {
    name   = "node_name"
    regex  = true
    values = ["node_us_[1-3]", "node_eu_[1-3]"]
  }
}

Argument Reference

  • node_name - (Optional) The node name. All cluster nodes will be queried in case this is omitted
  • tags - (Optional) A list of tags to filter the containers. The container must have all the tags to be included in the result.
  • filter - (Optional) Filter blocks. The container must satisfy all filter blocks to be included in the result.
    • name - Name of the container attribute to filter on. One of [name, template, status, node_name]
    • values - List of values to pass the filter. Container's attribute should match at least one value in the list.

Attribute Reference

  • containers - The containers list.
    • name - The container name.
    • node_name - The node name.
    • tags - A list of tags of the container.
    • vm_id - The container identifier.
    • status - Status of the container
    • template - Is container a template (true) or a regular container (false)