0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-08-26 05:15:39 +00:00
terraform-provider-proxmox/docs/data-sources/virtual_environment_containers.md
k69420s bacaf1799e
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>
2025-08-10 01:10:47 +02:00

63 lines
1.7 KiB
Markdown

---
layout: page
title: proxmox_virtual_environment_containers
parent: Data Sources
subcategory: Virtual Environment
---
# Data Source: proxmox_virtual_environment_containers
Retrieves information about all containers in the Proxmox cluster.
## Example Usage
```hcl
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)