OpenNebula/terraform-provider-opennebula

Data Source to get list of VMs by name

bdeetz opened this issue · 2 comments

bdeetz commented

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

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.

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