UNPKG

@pulumi/vsphere

Version:

A Pulumi package for creating vsphere resources

177 lines 8.1 kB
"use strict"; // *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** 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, Object.assign(Object.assign({}, 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 ? state.cpuExpandable : undefined; resourceInputs["cpuLimit"] = state ? state.cpuLimit : undefined; resourceInputs["cpuReservation"] = state ? state.cpuReservation : undefined; resourceInputs["cpuShareLevel"] = state ? state.cpuShareLevel : undefined; resourceInputs["cpuShares"] = state ? state.cpuShares : undefined; resourceInputs["customAttributes"] = state ? state.customAttributes : undefined; resourceInputs["memoryExpandable"] = state ? state.memoryExpandable : undefined; resourceInputs["memoryLimit"] = state ? state.memoryLimit : undefined; resourceInputs["memoryReservation"] = state ? state.memoryReservation : undefined; resourceInputs["memoryShareLevel"] = state ? state.memoryShareLevel : undefined; resourceInputs["memoryShares"] = state ? state.memoryShares : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["parentFolderId"] = state ? state.parentFolderId : undefined; resourceInputs["parentResourcePoolId"] = state ? state.parentResourcePoolId : undefined; resourceInputs["tags"] = state ? state.tags : undefined; } else { const args = argsOrState; if ((!args || args.parentResourcePoolId === undefined) && !opts.urn) { throw new Error("Missing required property 'parentResourcePoolId'"); } resourceInputs["cpuExpandable"] = args ? args.cpuExpandable : undefined; resourceInputs["cpuLimit"] = args ? args.cpuLimit : undefined; resourceInputs["cpuReservation"] = args ? args.cpuReservation : undefined; resourceInputs["cpuShareLevel"] = args ? args.cpuShareLevel : undefined; resourceInputs["cpuShares"] = args ? args.cpuShares : undefined; resourceInputs["customAttributes"] = args ? args.customAttributes : undefined; resourceInputs["memoryExpandable"] = args ? args.memoryExpandable : undefined; resourceInputs["memoryLimit"] = args ? args.memoryLimit : undefined; resourceInputs["memoryReservation"] = args ? args.memoryReservation : undefined; resourceInputs["memoryShareLevel"] = args ? args.memoryShareLevel : undefined; resourceInputs["memoryShares"] = args ? args.memoryShares : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["parentFolderId"] = args ? args.parentFolderId : undefined; resourceInputs["parentResourcePoolId"] = args ? args.parentResourcePoolId : undefined; resourceInputs["tags"] = args ? args.tags : undefined; } 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