mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-06-30 18:42:58 +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>
1.6 KiB
1.6 KiB
layout | title | parent | subcategory |
---|---|---|---|
page | proxmox_virtual_environment_vms | Data Sources | Virtual Environment |
Data Source: proxmox_virtual_environment_vms
Retrieves information about all VMs in the Proxmox cluster.
Example Usage
data "proxmox_virtual_environment_vms" "ubuntu_vms" {
tags = ["ubuntu"]
}
data "proxmox_virtual_environment_vms" "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 omittedtags
- (Optional) A list of tags to filter the VMs. The VM must have all the tags to be included in the result.filter
- (Optional) Filter blocks. The VM must satisfy all filter blocks to be included in the result.name
- Name of the VM attribute to filter on. One of [name
,template
,status
,node_name
]values
- List of values to pass the filter. VM's attribute should match at least one value in the list.
Attribute Reference
vms
- The VMs list.name
- The virtual machine name.node_name
- The node name.tags
- A list of tags of the VM.vm_id
- The VM identifier.status
- Status of the VMtemplate
- Is VM a template (true) or a regular VM (false)