@pulumi/vsphere
Version:
A Pulumi package for creating vsphere resources
424 lines (423 loc) • 16.5 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
/**
* The `vsphere.ResourcePool` resource can be used to create and manage
* resource pools on DRS-enabled vSphere clusters or standalone ESXi hosts.
*
* For more information on vSphere resource pools, please refer to the
* [product documentation][ref-vsphere-resource_pools].
*
* [ref-vsphere-resource_pools]: https://techdocs.broadcom.com/us/en/vmware-cis/vsphere/vsphere/8-0/vsphere-resource-management-8-0/managing-resource-pools.html
*
* ## Example Usage
*
* The following example sets up a resource pool in an existing compute cluster
* with the default settings for CPU and memory reservations, shares, and limits.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as vsphere from "@pulumi/vsphere";
*
* const datacenter = vsphere.getDatacenter({
* name: "dc-01",
* });
* const computeCluster = datacenter.then(datacenter => vsphere.getComputeCluster({
* name: "cluster-01",
* datacenterId: datacenter.id,
* }));
* const resourcePool = new vsphere.ResourcePool("resource_pool", {
* name: "resource-pool-01",
* parentResourcePoolId: computeCluster.then(computeCluster => computeCluster.resourcePoolId),
* });
* ```
*
* A virtual machine resource could be targeted to use the default resource pool
* of the cluster using the following:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as vsphere from "@pulumi/vsphere";
*
* const vm = new vsphere.VirtualMachine("vm", {resourcePoolId: cluster.resourcePoolId});
* ```
*
* The following example sets up a parent resource pool in an existing compute cluster
* with a child resource pool nested below. Each resource pool is configured with
* the default settings for CPU and memory reservations, shares, and limits.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as vsphere from "@pulumi/vsphere";
*
* const datacenter = vsphere.getDatacenter({
* name: "dc-01",
* });
* const computeCluster = datacenter.then(datacenter => vsphere.getComputeCluster({
* name: "cluster-01",
* datacenterId: datacenter.id,
* }));
* const resourcePoolParent = new vsphere.ResourcePool("resource_pool_parent", {
* name: "parent",
* parentResourcePoolId: computeCluster.then(computeCluster => computeCluster.resourcePoolId),
* });
* const resourcePoolChild = new vsphere.ResourcePool("resource_pool_child", {
* name: "child",
* parentResourcePoolId: resourcePoolParent.id,
* });
* ```
*
* The following example set up a parent resource pool on a standalone ESXi host with the default
* settings for CPU and memory reservations, shares, and limits.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as vsphere from "@pulumi/vsphere";
*
* const datacenter = vsphere.getDatacenter({
* name: "dc-01",
* });
* const thumbprint = vsphere.getHostThumbprint({
* address: "esxi-01.example.com",
* insecure: true,
* });
* const esx_01 = new vsphere.Host("esx-01", {
* hostname: "esxi-01.example.com",
* username: "root",
* password: "password",
* license: "00000-00000-00000-00000-00000",
* thumbprint: thumbprint.then(thumbprint => thumbprint.id),
* datacenter: datacenter.then(datacenter => datacenter.id),
* });
* ```
*
* After the hosts are added to the datacenter, a resource pool can then be created on the host.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as vsphere from "@pulumi/vsphere";
*
* const host = vsphere.getHost({
* name: "esxi-01.example.com",
* datacenterId: datacenter.id,
* });
* const resourcePool = new vsphere.ResourcePool("resource_pool", {
* name: "site1-resource-pool",
* parentResourcePoolId: host.then(host => host.resourcePoolId),
* });
* ```
*
* ## Import
*
* ### Settings that Require vSphere 7.0 or higher
*
* These settings require vSphere 7.0 or higher:
*
* * [`scale_descendants_shares`](#scale_descendants_shares)
*/
export declare class ResourcePool extends pulumi.CustomResource {
/**
* Get an existing ResourcePool resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name: string, id: pulumi.Input<pulumi.ID>, state?: ResourcePoolState, opts?: pulumi.CustomResourceOptions): ResourcePool;
/**
* Returns true if the given object is an instance of ResourcePool. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj: any): obj is ResourcePool;
/**
* Determines if the reservation on a resource
* pool can grow beyond the specified value if the parent resource pool has
* unreserved resources. Default: `true`
*/
readonly cpuExpandable: pulumi.Output<boolean | undefined>;
/**
* The CPU utilization of a resource pool will not
* exceed this limit, even if there are available resources. Set to `-1` for
* unlimited. Default: `-1`
*/
readonly cpuLimit: pulumi.Output<number | undefined>;
/**
* Amount of CPU (MHz) that is guaranteed
* available to the resource pool. Default: `0`
*/
readonly cpuReservation: pulumi.Output<number | undefined>;
/**
* The CPU allocation level. The level is a
* simplified view of shares. Levels map to a pre-determined set of numeric
* values for shares. Can be one of `low`, `normal`, `high`, or `custom`. When
* `low`, `normal`, or `high` are specified values in `cpuShares` will be
* ignored. Default: `normal`
*/
readonly cpuShareLevel: pulumi.Output<string | undefined>;
/**
* The number of shares allocated for CPU. Used to
* determine resource allocation in case of resource contention. If this is set,
* `cpuShareLevel` must be `custom`.
*/
readonly cpuShares: pulumi.Output<number>;
/**
* A list of custom attributes to set on this resource.
*/
readonly customAttributes: pulumi.Output<{
[key: string]: string;
} | undefined>;
/**
* Determines if the reservation on a resource
* pool can grow beyond the specified value if the parent resource pool has
* unreserved resources. Default: `true`
*/
readonly memoryExpandable: pulumi.Output<boolean | undefined>;
/**
* The CPU utilization of a resource pool will not
* exceed this limit, even if there are available resources. Set to `-1` for
* unlimited. Default: `-1`
*/
readonly memoryLimit: pulumi.Output<number | undefined>;
/**
* Amount of CPU (MHz) that is guaranteed
* available to the resource pool. Default: `0`
*/
readonly memoryReservation: pulumi.Output<number | undefined>;
/**
* The CPU allocation level. The level is a
* simplified view of shares. Levels map to a pre-determined set of numeric
* values for shares. Can be one of `low`, `normal`, `high`, or `custom`. When
* `low`, `normal`, or `high` are specified values in `memoryShares` will be
* ignored. Default: `normal`
*/
readonly memoryShareLevel: pulumi.Output<string | undefined>;
/**
* The number of shares allocated for CPU. Used to
* determine resource allocation in case of resource contention. If this is set,
* `memoryShareLevel` must be `custom`.
*/
readonly memoryShares: pulumi.Output<number>;
/**
* The name of the resource pool.
*/
readonly name: pulumi.Output<string>;
/**
* The managed object ID
* of the parent resource pool. This can be the root resource pool for a cluster
* or standalone host, or a resource pool itself. When moving a resource pool
* from one parent resource pool to another, both must share a common root
* resource pool.
*/
readonly parentResourcePoolId: pulumi.Output<string>;
/**
* Determines if the shares of all
* descendants of the resource pool are scaled up or down when the shares
* of the resource pool are scaled up or down. Can be one of `disabled` or
* `scaleCpuAndMemoryShares`. Default: `disabled`.
*/
readonly scaleDescendantsShares: pulumi.Output<string | undefined>;
/**
* The IDs of any tags to attach to this resource.
*/
readonly tags: pulumi.Output<string[] | undefined>;
/**
* Create a ResourcePool resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: ResourcePoolArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering ResourcePool resources.
*/
export interface ResourcePoolState {
/**
* Determines if the reservation on a resource
* pool can grow beyond the specified value if the parent resource pool has
* unreserved resources. Default: `true`
*/
cpuExpandable?: pulumi.Input<boolean>;
/**
* The CPU utilization of a resource pool will not
* exceed this limit, even if there are available resources. Set to `-1` for
* unlimited. Default: `-1`
*/
cpuLimit?: pulumi.Input<number>;
/**
* Amount of CPU (MHz) that is guaranteed
* available to the resource pool. Default: `0`
*/
cpuReservation?: pulumi.Input<number>;
/**
* The CPU allocation level. The level is a
* simplified view of shares. Levels map to a pre-determined set of numeric
* values for shares. Can be one of `low`, `normal`, `high`, or `custom`. When
* `low`, `normal`, or `high` are specified values in `cpuShares` will be
* ignored. Default: `normal`
*/
cpuShareLevel?: pulumi.Input<string>;
/**
* The number of shares allocated for CPU. Used to
* determine resource allocation in case of resource contention. If this is set,
* `cpuShareLevel` must be `custom`.
*/
cpuShares?: pulumi.Input<number>;
/**
* A list of custom attributes to set on this resource.
*/
customAttributes?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* Determines if the reservation on a resource
* pool can grow beyond the specified value if the parent resource pool has
* unreserved resources. Default: `true`
*/
memoryExpandable?: pulumi.Input<boolean>;
/**
* The CPU utilization of a resource pool will not
* exceed this limit, even if there are available resources. Set to `-1` for
* unlimited. Default: `-1`
*/
memoryLimit?: pulumi.Input<number>;
/**
* Amount of CPU (MHz) that is guaranteed
* available to the resource pool. Default: `0`
*/
memoryReservation?: pulumi.Input<number>;
/**
* The CPU allocation level. The level is a
* simplified view of shares. Levels map to a pre-determined set of numeric
* values for shares. Can be one of `low`, `normal`, `high`, or `custom`. When
* `low`, `normal`, or `high` are specified values in `memoryShares` will be
* ignored. Default: `normal`
*/
memoryShareLevel?: pulumi.Input<string>;
/**
* The number of shares allocated for CPU. Used to
* determine resource allocation in case of resource contention. If this is set,
* `memoryShareLevel` must be `custom`.
*/
memoryShares?: pulumi.Input<number>;
/**
* The name of the resource pool.
*/
name?: pulumi.Input<string>;
/**
* The managed object ID
* of the parent resource pool. This can be the root resource pool for a cluster
* or standalone host, or a resource pool itself. When moving a resource pool
* from one parent resource pool to another, both must share a common root
* resource pool.
*/
parentResourcePoolId?: pulumi.Input<string>;
/**
* Determines if the shares of all
* descendants of the resource pool are scaled up or down when the shares
* of the resource pool are scaled up or down. Can be one of `disabled` or
* `scaleCpuAndMemoryShares`. Default: `disabled`.
*/
scaleDescendantsShares?: pulumi.Input<string>;
/**
* The IDs of any tags to attach to this resource.
*/
tags?: pulumi.Input<pulumi.Input<string>[]>;
}
/**
* The set of arguments for constructing a ResourcePool resource.
*/
export interface ResourcePoolArgs {
/**
* Determines if the reservation on a resource
* pool can grow beyond the specified value if the parent resource pool has
* unreserved resources. Default: `true`
*/
cpuExpandable?: pulumi.Input<boolean>;
/**
* The CPU utilization of a resource pool will not
* exceed this limit, even if there are available resources. Set to `-1` for
* unlimited. Default: `-1`
*/
cpuLimit?: pulumi.Input<number>;
/**
* Amount of CPU (MHz) that is guaranteed
* available to the resource pool. Default: `0`
*/
cpuReservation?: pulumi.Input<number>;
/**
* The CPU allocation level. The level is a
* simplified view of shares. Levels map to a pre-determined set of numeric
* values for shares. Can be one of `low`, `normal`, `high`, or `custom`. When
* `low`, `normal`, or `high` are specified values in `cpuShares` will be
* ignored. Default: `normal`
*/
cpuShareLevel?: pulumi.Input<string>;
/**
* The number of shares allocated for CPU. Used to
* determine resource allocation in case of resource contention. If this is set,
* `cpuShareLevel` must be `custom`.
*/
cpuShares?: pulumi.Input<number>;
/**
* A list of custom attributes to set on this resource.
*/
customAttributes?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* Determines if the reservation on a resource
* pool can grow beyond the specified value if the parent resource pool has
* unreserved resources. Default: `true`
*/
memoryExpandable?: pulumi.Input<boolean>;
/**
* The CPU utilization of a resource pool will not
* exceed this limit, even if there are available resources. Set to `-1` for
* unlimited. Default: `-1`
*/
memoryLimit?: pulumi.Input<number>;
/**
* Amount of CPU (MHz) that is guaranteed
* available to the resource pool. Default: `0`
*/
memoryReservation?: pulumi.Input<number>;
/**
* The CPU allocation level. The level is a
* simplified view of shares. Levels map to a pre-determined set of numeric
* values for shares. Can be one of `low`, `normal`, `high`, or `custom`. When
* `low`, `normal`, or `high` are specified values in `memoryShares` will be
* ignored. Default: `normal`
*/
memoryShareLevel?: pulumi.Input<string>;
/**
* The number of shares allocated for CPU. Used to
* determine resource allocation in case of resource contention. If this is set,
* `memoryShareLevel` must be `custom`.
*/
memoryShares?: pulumi.Input<number>;
/**
* The name of the resource pool.
*/
name?: pulumi.Input<string>;
/**
* The managed object ID
* of the parent resource pool. This can be the root resource pool for a cluster
* or standalone host, or a resource pool itself. When moving a resource pool
* from one parent resource pool to another, both must share a common root
* resource pool.
*/
parentResourcePoolId: pulumi.Input<string>;
/**
* Determines if the shares of all
* descendants of the resource pool are scaled up or down when the shares
* of the resource pool are scaled up or down. Can be one of `disabled` or
* `scaleCpuAndMemoryShares`. Default: `disabled`.
*/
scaleDescendantsShares?: pulumi.Input<string>;
/**
* The IDs of any tags to attach to this resource.
*/
tags?: pulumi.Input<pulumi.Input<string>[]>;
}