The vsphere_compute_cluster data source can be used to discover the ID of a cluster in vSphere. This is useful to fetch the ID of a cluster that you want to use for virtual machine placement via the vsphere_virtual_machine resource, allowing you to specify the cluster's root resource pool directly versus using the alias available through the vsphere_resource_pool data source.

Example Usage

data "vsphere_datacenter" "datacenter" {
  name = "dc1"

data "vsphere_compute_cluster" "compute_cluster" {
  name          = "compute-cluster1"
  datacenter_id = "${data.vsphere_datacenter.dc.id}"

Argument Reference

The following arguments are supported:

  • name - (Required) The name or absolute path to the cluster.
  • datacenter_id - (Optional) The managed object reference ID of the datacenter the cluster is located in. This can be omitted if the search path used in name is an absolute path. For default datacenters, use the id attribute from an empty vsphere_datacenter data source.

Attribute Reference

The following attributes are exported:

© 2018 HashiCorpLicensed under the MPL 2.0 License.