@pulumi/vsphere
Version:
A Pulumi package for creating vsphere resources
177 lines • 7.49 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.VappContainer = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* The `vsphere.VappContainer` resource can be used to create and manage
* vApps.
*
* For more information on vSphere vApps, see the VMware vSphere [product documentation][ref-vsphere-vapp].
*
* [ref-vsphere-vapp]: https://techdocs.broadcom.com/us/en/vmware-cis/vsphere/vsphere/8-0/vsphere-virtual-machine-administration-guide-8-0/managing-multi-tiered-applications-with-vsphere-vapp-in-the-vsphere-web-clientvsphere-vm-admin.html
*
* ## Basic Example
*
* The example below sets up a vSphere vApp container in a compute cluster which uses
* the default settings for CPU and memory reservations, shares, and limits. The compute cluster
* needs to already exist in vSphere.
*
* ```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 vappContainer = new vsphere.VappContainer("vapp_container", {
* name: "vapp-01",
* parentResourcePoolId: computeCluster.then(computeCluster => computeCluster.resourcePoolId),
* });
* ```
*
* ### Example with a Virtual Machine
*
* The example below builds off the basic example, but includes a virtual machine
* in the new vApp container. To accomplish this, the `resourcePoolId` of the
* virtual machine is set to the `id` of the vApp container.
*
* ```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 datastore = datacenter.then(datacenter => vsphere.getDatastore({
* name: "datastore-01",
* datacenterId: datacenter.id,
* }));
* const network = datacenter.then(datacenter => vsphere.getNetwork({
* name: "VM Network",
* datacenterId: datacenter.id,
* }));
* const vappContainer = new vsphere.VappContainer("vapp_container", {
* name: "vapp-01",
* parentResourcePoolId: computeCluster.then(computeCluster => computeCluster.resourcePoolId),
* });
* const vm = new vsphere.VirtualMachine("vm", {
* name: "foo",
* resourcePoolId: vappContainerVsphereVappContainer.id,
* datastoreId: datastore.then(datastore => datastore.id),
* numCpus: 1,
* memory: 1024,
* guestId: "ubuntu64Guest",
* networkInterfaces: [{
* networkId: network.then(network => network.id),
* }],
* disks: [{
* label: "disk0",
* size: 20,
* }],
* });
* ```
*
* ## Import
*
* An existing vApp container can be imported into this resource via
*
* the path to the vApp container, using the following command:
*
* [docs-import]: https://developer.hashicorp.com/terraform/cli/import
*
* Example:
*
* ```sh
* $ pulumi import vsphere:index/vappContainer:VappContainer vapp_container /dc-01/host/cluster-01/Resources/resource-pool-01/vapp-01
* ```
*
* The example above would import the vApp container named `vapp-01` that is
*
* located in the resource pool `resource-pool-01` that is part of the host cluster
*
* `cluster-01` in the `dc-01` datacenter.
*/
class VappContainer extends pulumi.CustomResource {
/**
* Get an existing VappContainer 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, id, state, opts) {
return new VappContainer(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of VappContainer. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === VappContainer.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["cpuExpandable"] = state?.cpuExpandable;
resourceInputs["cpuLimit"] = state?.cpuLimit;
resourceInputs["cpuReservation"] = state?.cpuReservation;
resourceInputs["cpuShareLevel"] = state?.cpuShareLevel;
resourceInputs["cpuShares"] = state?.cpuShares;
resourceInputs["customAttributes"] = state?.customAttributes;
resourceInputs["memoryExpandable"] = state?.memoryExpandable;
resourceInputs["memoryLimit"] = state?.memoryLimit;
resourceInputs["memoryReservation"] = state?.memoryReservation;
resourceInputs["memoryShareLevel"] = state?.memoryShareLevel;
resourceInputs["memoryShares"] = state?.memoryShares;
resourceInputs["name"] = state?.name;
resourceInputs["parentFolderId"] = state?.parentFolderId;
resourceInputs["parentResourcePoolId"] = state?.parentResourcePoolId;
resourceInputs["tags"] = state?.tags;
}
else {
const args = argsOrState;
if (args?.parentResourcePoolId === undefined && !opts.urn) {
throw new Error("Missing required property 'parentResourcePoolId'");
}
resourceInputs["cpuExpandable"] = args?.cpuExpandable;
resourceInputs["cpuLimit"] = args?.cpuLimit;
resourceInputs["cpuReservation"] = args?.cpuReservation;
resourceInputs["cpuShareLevel"] = args?.cpuShareLevel;
resourceInputs["cpuShares"] = args?.cpuShares;
resourceInputs["customAttributes"] = args?.customAttributes;
resourceInputs["memoryExpandable"] = args?.memoryExpandable;
resourceInputs["memoryLimit"] = args?.memoryLimit;
resourceInputs["memoryReservation"] = args?.memoryReservation;
resourceInputs["memoryShareLevel"] = args?.memoryShareLevel;
resourceInputs["memoryShares"] = args?.memoryShares;
resourceInputs["name"] = args?.name;
resourceInputs["parentFolderId"] = args?.parentFolderId;
resourceInputs["parentResourcePoolId"] = args?.parentResourcePoolId;
resourceInputs["tags"] = args?.tags;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(VappContainer.__pulumiType, name, resourceInputs, opts);
}
}
exports.VappContainer = VappContainer;
/** @internal */
VappContainer.__pulumiType = 'vsphere:index/vappContainer:VappContainer';
//# sourceMappingURL=vappContainer.js.map