mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-08-26 05:15:39 +00:00
- 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>
40 lines
957 B
HCL
40 lines
957 B
HCL
data "proxmox_virtual_environment_containers" "example" {
|
|
depends_on = [proxmox_virtual_environment_container.example]
|
|
tags = ["ubuntu"]
|
|
|
|
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 = ["ubuntu"]
|
|
|
|
filter {
|
|
name = "template"
|
|
values = [false]
|
|
}
|
|
|
|
filter {
|
|
name = "status"
|
|
values = ["running"]
|
|
}
|
|
|
|
filter {
|
|
name = "name"
|
|
regex = true
|
|
values = [".*ubuntu.*"]
|
|
}
|
|
}
|
|
|
|
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
|
|
} |