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
NOTE: Fetching the root resource pool for a cluster can now be done directly via the
vsphere_compute_cluster
data source.
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 inname
is an absolute path. For default datacenters, use the id attribute from an emptyvsphere_datacenter
data source.
Note when using with standalone ESXi: When using ESXi without vCenter, you don't have to specify either attribute to use this data source. An empty declaration will load the host's root resource pool.
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.
© 2018 HashiCorpLicensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/vsphere/d/resource_pool.html