mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-06-29 18:21:10 +00:00
* feat(vm): implement filtering in vms data source. * Additional attributes for vm data source (status, template) * fix qodana CI job condition --------- Signed-off-by: Konstantin Kornienko <konstantin.kornienko@gmail.com> Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com> Co-authored-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
41 lines
874 B
HCL
41 lines
874 B
HCL
data "proxmox_virtual_environment_vms" "example" {
|
|
depends_on = [proxmox_virtual_environment_vm.example]
|
|
tags = ["ubuntu"]
|
|
|
|
lifecycle {
|
|
postcondition {
|
|
condition = length(self.vms) == 1
|
|
error_message = "Only 1 vm should have this tag"
|
|
}
|
|
}
|
|
}
|
|
|
|
data "proxmox_virtual_environment_vms" "template_example" {
|
|
depends_on = [proxmox_virtual_environment_vm.example]
|
|
tags = ["ubuntu"]
|
|
|
|
filter {
|
|
name = "template"
|
|
values = [false]
|
|
}
|
|
|
|
filter {
|
|
name = "status"
|
|
values = ["running"]
|
|
}
|
|
|
|
filter {
|
|
name = "name"
|
|
regex = true
|
|
values = [".*ubuntu.*"]
|
|
}
|
|
}
|
|
|
|
output "proxmox_virtual_environment_vms_example" {
|
|
value = data.proxmox_virtual_environment_vms.example.vms
|
|
}
|
|
|
|
output "proxmox_virtual_environment_template_vms_example" {
|
|
value = data.proxmox_virtual_environment_vms.template_example.vms
|
|
}
|