Manage VMware vSphere resource pools with vsphere_resource_pool
mainThe vsphere_resource_pool resource allows you to create and manage resource pools on DRS-enabled vSphere clusters or standalone ESXi hosts. You can use these pools to partition CPU and memory resources for virtual machines or nested resource pools.
Key Concepts
- Parenting: Every resource pool must have a
parent_resource_pool_id. This can be the root resource pool of a cluster, a standalone host, or another resource pool (for nesting). - Moving Pools: When moving a resource pool from one parent to another, both the old and new parents must share a common root resource pool.
- Targeting VMs: To assign a virtual machine to a specific resource pool, set the
resource_pool_idargument within thevsphere_virtual_machineresource.
resource "vsphere_resource_pool" "resource_pool" {
name = "resource-pool-01"
parent_resource_pool_id = data.vsphere_compute_cluster.compute_cluster.resource_pool_id
}
resource "vsphere_virtual_machine" "vm" {
# ... other configuration ...
resource_pool_id = data.vsphere_compute_cluster.cluster.resource_pool_id
# ... other configuration ...
}