OpenNebula / terraform-provider-opennebula

Terraform provider for OpenNebula
https://www.terraform.io/docs/providers/opennebula/
Mozilla Public License 2.0
61 stars 54 forks source link

Data Source to get list of VMs by name #485

Open bdeetz opened 11 months ago

bdeetz commented 11 months ago

Description

It would be nice to be able to lookup data for a VM by name. For instance:

data "opennebula_virtual_machine" "machines" {
  name = "my-host-*"
}

The result would be all attributes output from the opennebula_virtual_machine resource for all VMs in an ON environment matching that expression. The result could be a list of machines.

New or affected resources and data sources

proposed new: data "opennebula_virtual_machine"

Potential terraform configuration

see description

References

No response

bdeetz commented 11 months ago

This would be useful when deploying services where the service resource provides no outputs regarding the VMs it deploys.

For example. If you deploy OneKE for a kube cluster, you need to pull the kube config off of the master in order to configure your local client to connect. You don't know the IP addr to connect to to retrieve that config. Which means you can't automate retrieval.

treywelsh commented 11 months ago

I suppose that we should introduce a new datasource opennebula_virtual_machines to be consistent with the openenbula_templates datasource introduced by #322 See doc