0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-08-22 11:28:33 +00:00
terraform-provider-proxmox/example/data_source_virtual_environment_containers.tf
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

35 lines
878 B
HCL

data "proxmox_virtual_environment_containers" "example" {
depends_on = [proxmox_virtual_environment_container.example]
tags = ["example"]
lifecycle {
postcondition {
condition = length(self.containers) == 1
error_message = "Only 1 container should have this tag"
}
}
}
data "proxmox_virtual_environment_containers" "template_example" {
depends_on = [proxmox_virtual_environment_container.example]
tags = ["example"]
filter {
name = "template"
values = [false]
}
filter {
name = "status"
values = ["running"]
}
}
output "proxmox_virtual_environment_containers_example" {
value = data.proxmox_virtual_environment_containers.example.containers
}
output "proxmox_virtual_environment_template_containers_example" {
value = data.proxmox_virtual_environment_containers.template_example.containers
}