Closed camaeel closed 3 days ago
PVE automatically lowercase tags. This use case works:
VM:
config:
data "proxmox_virtual_environment_vms" "test" {
tags = [ "abc", "def" ]
}
output "vms" {
value = data.proxmox_virtual_environment_vms.test.vms
}
tofu apply -auto-approve
❯ tofu apply -auto-approve
data.proxmox_virtual_environment_vms.test: Reading...
data.proxmox_virtual_environment_vms.test: Read complete after 0s [id=fae91e9a-8762-4d9f-a053-6b3aa2a1747a]
Changes to Outputs:
+ vms = [
+ {
+ name = "VM 100"
+ node_name = "pve"
+ status = "stopped"
+ tags = [
+ "abc",
+ "def",
]
+ template = false
+ vm_id = 100
},
]
You can apply this plan to save these new output values to the OpenTofu state, without changing any real infrastructure.
Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
Outputs:
vms = tolist([
{
"name" = "VM 100"
"node_name" = "pve"
"status" = "stopped"
"tags" = tolist([
"abc",
"def",
])
"template" = false
"vm_id" = 100
},
])
@camaeel could you try your tags filter in lowercase and see if it works?
If it still doesn't could you post output of qm config <your vm id>
(run in PVE shell) pls?
@bpg Thanx, it seems it works for me as well. No idea what was the issue, I change the code and the setup since then.
Describe the bug I have VM with 2 tags: ABC, DEF. When I create data source like:
this VM is not found.
To find it I have to specify resource like this
so tags need to be concatenated in alphabetical order in order to select VM
To Reproduce Steps to reproduce the behavior:
Please also provide a minimal Terraform configuration that reproduces the issue.
Expected behavior Documentation states that it is enough to provide list off tags like this:
Screenshots If applicable, add screenshots to help explain your problem.
Additional context Add any other context about the problem here.
TF_LOG=DEBUG terraform apply
):