terraform-provider-vsphere icon indicating copy to clipboard operation
terraform-provider-vsphere copied to clipboard

vsphere_dynamic should return list of ids if multiple matches found

Open bjvrielink opened this issue 1 year ago • 1 comments

Community Guidelines

  • [X] I have read and agree to the HashiCorp Community Guidelines .
  • [X] Vote on this issue by adding a 👍 reaction to the original issue initial description to help the maintainers prioritize.
  • [X] Do not leave "+1" or other comments that do not add relevant information or questions.
  • [X] If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Terraform

v1.6.5

Terraform Provider

v2.6.0

VMware vSphere

v7.0.3

Description

I'm looking for a way to get a list of VMs to assign an anti-affinity rule to. A vsphere_dynamic data source looks promising, but when I use it to filter all VMs that have the same tag, I get a message "multiple objects match the supplied criteria" instead of a list of those multiple objects.

Affected Resources or Data Sources

data/vsphere_dynamic

Terraform Configuration

data "vsphere_tag_category" "cluster" { name = "K8s Cluster" } data "vsphere_tag" "my_cluster" { name = "test" category_id = data.vsphere_tag_category.cluster.id } data "vsphere_dynamic" "cluster" { filter = [ data.vsphere_tag.my_cluster.id ] }

Debug Output

N/A

Panic Output

No response

Expected Behavior

I would expect a list of VSphere device IDs of the VMs that match my filter

Actual Behavior

Error: multiple objects match the supplied criteria

Steps to Reproduce

  1. Assign the same tag to multiple VMs in VSphere
  2. Use vsphere_dynamic data source with a filter that matches this tag
  3. terraform apply

Environment Details

No response

Screenshots

No response

References

No response

bjvrielink avatar Dec 28 '23 09:12 bjvrielink

Hello, bjvrielink! 🖐

Thank you for submitting an issue for this provider. The issue will now enter into the issue lifecycle.

If you want to contribute to this project, please review the contributing guidelines and information on submitting pull requests.

github-actions[bot] avatar Dec 28 '23 09:12 github-actions[bot]