» vsphere_resource_pool

The vsphere_resource_pool data source can be used to discover the ID of a resource pool in vSphere. This is useful to fetch the ID of a resource pool that you want to use to create virtual machines in using the vsphere_virtual_machine resource.

» Example Usage

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

data "vsphere_resource_pool" "pool" {
  name          = "resource-pool-1"
  datacenter_id = "${data.vsphere_datacenter.datacenter.id}"
}

» Specifying the root resource pool for a standalone host

All compute resources in vSphere (clusters, standalone hosts, and standalone ESXi) have a resource pool, even if one has not been explicitly created. This resource pool is referred to as the root resource pool and can be looked up by specifying the path as per the example below:

data "vsphere_resource_pool" "pool" {
  name          = "esxi1/Resources"
  datacenter_id = "${data.vsphere_datacenter.dc.id}"
}

For more information on the root resource pool, see Managing Resource Pools in the vSphere documentation.

» Argument Reference

The following arguments are supported:

  • name - (Optional) The name of the resource pool. This can be a name or path. This is required when using vCenter.
  • datacenter_id - (Optional) The managed object reference ID of the datacenter the resource pool 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

Currently, the only exported attribute from this data source is id, which represents the ID of the resource pool that was looked up.