0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-06-30 18:42:58 +00:00
terraform-provider-proxmox/docs/data-sources/virtual_environment_vms.md
Konstantin Kornienko 65f8ba5bfe
feat(vm): implement filtering in vms data source. (#1423)
* 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>
2024-07-05 15:52:39 -04:00

64 lines
1.6 KiB
Markdown

---
layout: page
title: proxmox_virtual_environment_vms
parent: Data Sources
subcategory: Virtual Environment
---
# Data Source: proxmox_virtual_environment_vms
Retrieves information about all VMs in the Proxmox cluster.
## Example Usage
```hcl
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 omitted
- `tags` - (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 VM
- `template` - Is VM a template (true) or a regular VM (false)