@pulumi/vsphere
Version:
A Pulumi package for creating vsphere resources
208 lines (207 loc) • 7.92 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
/**
* The `vsphere.DrsVmOverride` resource can be used to add a DRS override to a
* cluster for a specific virtual machine. With this resource, one can enable or
* disable DRS and control the automation level for a single virtual machine
* without affecting the rest of the cluster.
*
* For more information on vSphere clusters and DRS, see [this
* page][ref-vsphere-drs-clusters].
*
* [ref-vsphere-drs-clusters]: https://techdocs.broadcom.com/us/en/vmware-cis/vsphere/vsphere/8-0/vsphere-resource-management-8-0/creating-a-drs-cluster.html
*
* > **NOTE:** This resource requires vCenter and is not available on direct ESXi
* connections.
*
* ## Example Usage
*
* The example below creates a virtual machine in a cluster using the
* `vsphere.VirtualMachine` resource, creating the
* virtual machine in the cluster looked up by the
* `vsphere.ComputeCluster` data source, but also
* pinning the VM to a host defined by the
* `vsphere.Host` data source, which is assumed to
* be a host within the cluster. To ensure that the VM stays on this host and does
* not need to be migrated back at any point in time, an override is entered using
* the `vsphere.DrsVmOverride` resource that disables DRS for this virtual
* machine, ensuring that it does not move.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as vsphere from "@pulumi/vsphere";
*
* const datacenter = vsphere.getDatacenter({
* name: "dc-01",
* });
* const datastore = datacenter.then(datacenter => vsphere.getDatastore({
* name: "datastore1",
* datacenterId: datacenter.id,
* }));
* const cluster = datacenter.then(datacenter => vsphere.getComputeCluster({
* name: "cluster-01",
* datacenterId: datacenter.id,
* }));
* const host = datacenter.then(datacenter => vsphere.getHost({
* name: "esxi-01.example.com",
* datacenterId: datacenter.id,
* }));
* const network = datacenter.then(datacenter => vsphere.getNetwork({
* name: "network1",
* datacenterId: datacenter.id,
* }));
* const vm = new vsphere.VirtualMachine("vm", {
* name: "test",
* resourcePoolId: cluster.then(cluster => cluster.resourcePoolId),
* hostSystemId: host.then(host => host.id),
* datastoreId: datastore.then(datastore => datastore.id),
* numCpus: 2,
* memory: 2048,
* guestId: "otherLinux64Guest",
* networkInterfaces: [{
* networkId: network.then(network => network.id),
* }],
* disks: [{
* label: "disk0",
* size: 20,
* }],
* });
* const drsVmOverride = new vsphere.DrsVmOverride("drs_vm_override", {
* computeClusterId: cluster.then(cluster => cluster.id),
* virtualMachineId: vm.id,
* drsEnabled: false,
* });
* ```
*
* ## Import
*
* An existing override can be imported into this resource by
*
* supplying both the path to the cluster, and the path to the virtual machine, to
*
* `pulumi import`. If no override exists, an error will be given. An example
*
* is below:
*
* [docs-import]: https://developer.hashicorp.com/terraform/cli/import
*
* ```sh
* $ pulumi import vsphere:index/drsVmOverride:DrsVmOverride drs_vm_override \
* ```
*
* '{"compute_cluster_path": "/dc1/host/cluster1", \
*
* "virtual_machine_path": "/dc1/vm/srv1"}'
*/
export declare class DrsVmOverride extends pulumi.CustomResource {
/**
* Get an existing DrsVmOverride 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?: DrsVmOverrideState, opts?: pulumi.CustomResourceOptions): DrsVmOverride;
/**
* Returns true if the given object is an instance of DrsVmOverride. 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 DrsVmOverride;
/**
* The managed object reference
* ID of the cluster to put the override in. Forces a new
* resource if changed.
*/
readonly computeClusterId: pulumi.Output<string>;
/**
* Overrides the automation level for this virtual
* machine in the cluster. Can be one of `manual`, `partiallyAutomated`, or
* `fullyAutomated`. Default: `manual`.
*
* > **NOTE:** Using this resource _always_ implies an override, even if one of
* `drsEnabled` or `drsAutomationLevel` is omitted. Take note of the defaults
* for both options.
*/
readonly drsAutomationLevel: pulumi.Output<string | undefined>;
/**
* Overrides the default DRS setting for this virtual
* machine. Can be either `true` or `false`. Default: `false`.
*/
readonly drsEnabled: pulumi.Output<boolean | undefined>;
/**
* The UUID of the virtual machine to create
* the override for. Forces a new resource if changed.
*/
readonly virtualMachineId: pulumi.Output<string>;
/**
* Create a DrsVmOverride 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: DrsVmOverrideArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering DrsVmOverride resources.
*/
export interface DrsVmOverrideState {
/**
* The managed object reference
* ID of the cluster to put the override in. Forces a new
* resource if changed.
*/
computeClusterId?: pulumi.Input<string>;
/**
* Overrides the automation level for this virtual
* machine in the cluster. Can be one of `manual`, `partiallyAutomated`, or
* `fullyAutomated`. Default: `manual`.
*
* > **NOTE:** Using this resource _always_ implies an override, even if one of
* `drsEnabled` or `drsAutomationLevel` is omitted. Take note of the defaults
* for both options.
*/
drsAutomationLevel?: pulumi.Input<string>;
/**
* Overrides the default DRS setting for this virtual
* machine. Can be either `true` or `false`. Default: `false`.
*/
drsEnabled?: pulumi.Input<boolean>;
/**
* The UUID of the virtual machine to create
* the override for. Forces a new resource if changed.
*/
virtualMachineId?: pulumi.Input<string>;
}
/**
* The set of arguments for constructing a DrsVmOverride resource.
*/
export interface DrsVmOverrideArgs {
/**
* The managed object reference
* ID of the cluster to put the override in. Forces a new
* resource if changed.
*/
computeClusterId: pulumi.Input<string>;
/**
* Overrides the automation level for this virtual
* machine in the cluster. Can be one of `manual`, `partiallyAutomated`, or
* `fullyAutomated`. Default: `manual`.
*
* > **NOTE:** Using this resource _always_ implies an override, even if one of
* `drsEnabled` or `drsAutomationLevel` is omitted. Take note of the defaults
* for both options.
*/
drsAutomationLevel?: pulumi.Input<string>;
/**
* Overrides the default DRS setting for this virtual
* machine. Can be either `true` or `false`. Default: `false`.
*/
drsEnabled?: pulumi.Input<boolean>;
/**
* The UUID of the virtual machine to create
* the override for. Forces a new resource if changed.
*/
virtualMachineId: pulumi.Input<string>;
}