@pulumi/vsphere
Version:
A Pulumi package for creating vsphere resources
247 lines (246 loc) • 10.3 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
/**
* The `vsphere.Folder` resource can be used to manage vSphere inventory folders.
* The resource supports creating folders of the 5 major types - datacenter
* folders, host and cluster folders, virtual machine folders, storage folders,
* and network folders.
*
* Paths are always relative to the specific type of folder you are creating.
* A subfolder is discovered by parsing the relative path specified in `path`, so
* `foo/bar` will create a folder named `bar` in the parent folder `foo`, as long
* as the folder `foo` exists.
*
* ## Example Usage
*
* The basic example below creates a virtual machine folder named
* `test-folder` in the default datacenter's VM hierarchy.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as vsphere from "@pulumi/vsphere";
*
* const datacenter = vsphere.getDatacenter({
* name: vsphereDatacenter,
* });
* const folder = new vsphere.Folder("folder", {
* path: "test-folder",
* type: "vm",
* datacenterId: datacenter.then(datacenter => datacenter.id),
* });
* ```
*
* ### Example with Sub-folders
*
* The below example builds off of the above by first creating a folder named
* `test-parent`, and then locating `test-folder` in that
* folder. To ensure the parent is created first, we create an interpolation
* dependency off the parent's `path` attribute.
*
* Note that if you change parents (for example, went from the above basic
* configuration to this one), your folder will be moved to be under the correct
* parent.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as vsphere from "@pulumi/vsphere";
*
* const datacenter = vsphere.getDatacenter({
* name: vsphereDatacenter,
* });
* const parent = new vsphere.Folder("parent", {
* path: "test-parent",
* type: "vm",
* datacenterId: datacenter.then(datacenter => datacenter.id),
* });
* const folder = new vsphere.Folder("folder", {
* path: pulumi.interpolate`${parent.path}/test-folder`,
* type: "vm",
* datacenterId: datacenter.then(datacenter => datacenter.id),
* });
* ```
*
* ## Import
*
* An existing folder can be imported into this resource via
*
* its full path, via the following command:
*
* [docs-import]: https://developer.hashicorp.com/terraform/cli/import
*
* ```sh
* $ pulumi import vsphere:index/folder:Folder folder /default-dc/vm/example-vm-folder
* ```
*
* The above command would import the folder from our examples above, the VM
*
* folder named `example-vm-folder` located in the datacenter named
*
* `default-dc`.
*/
export declare class Folder extends pulumi.CustomResource {
/**
* Get an existing Folder 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?: FolderState, opts?: pulumi.CustomResourceOptions): Folder;
/**
* Returns true if the given object is an instance of Folder. 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 Folder;
/**
* Map of custom attribute ids to attribute
* value strings to set for folder. See [here][docs-setting-custom-attributes]
* for a reference on how to set values for custom attributes.
*
* [docs-setting-custom-attributes]: /docs/providers/vsphere/r/custom_attribute.html#using-custom-attributes-in-a-supported-resource
*
* > **NOTE:** Custom attributes are unsupported on direct ESXi connections
* and require vCenter.
*/
readonly customAttributes: pulumi.Output<{
[key: string]: string;
} | undefined>;
/**
* The ID of the datacenter the folder will be created in.
* Required for all folder types except for datacenter folders. Forces a new
* resource if changed.
*/
readonly datacenterId: pulumi.Output<string | undefined>;
/**
* The path of the folder to be created. This is relative to
* the root of the type of folder you are creating, and the supplied datacenter.
* For example, given a default datacenter of `default-dc`, a folder of type
* `vm` (denoting a virtual machine folder), and a supplied folder of
* `test-folder`, the resulting path would be
* `/default-dc/vm/test-folder`.
*
* > **NOTE:** `path` can be modified - the resulting behavior is dependent on
* what section of `path` you are modifying. If you are modifying the parent (so
* any part before the last `/`), your folder will be moved to that new parent. If
* modifying the name (the part after the last `/`), your folder will be renamed.
*/
readonly path: pulumi.Output<string>;
/**
* The IDs of any tags to attach to this resource.
*/
readonly tags: pulumi.Output<string[] | undefined>;
/**
* The type of folder to create. Allowed options are
* `datacenter` for datacenter folders, `host` for host and cluster folders,
* `vm` for virtual machine folders, `datastore` for datastore folders, and
* `network` for network folders. Forces a new resource if changed.
*/
readonly type: pulumi.Output<string>;
/**
* Create a Folder 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: FolderArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering Folder resources.
*/
export interface FolderState {
/**
* Map of custom attribute ids to attribute
* value strings to set for folder. See [here][docs-setting-custom-attributes]
* for a reference on how to set values for custom attributes.
*
* [docs-setting-custom-attributes]: /docs/providers/vsphere/r/custom_attribute.html#using-custom-attributes-in-a-supported-resource
*
* > **NOTE:** Custom attributes are unsupported on direct ESXi connections
* and require vCenter.
*/
customAttributes?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* The ID of the datacenter the folder will be created in.
* Required for all folder types except for datacenter folders. Forces a new
* resource if changed.
*/
datacenterId?: pulumi.Input<string>;
/**
* The path of the folder to be created. This is relative to
* the root of the type of folder you are creating, and the supplied datacenter.
* For example, given a default datacenter of `default-dc`, a folder of type
* `vm` (denoting a virtual machine folder), and a supplied folder of
* `test-folder`, the resulting path would be
* `/default-dc/vm/test-folder`.
*
* > **NOTE:** `path` can be modified - the resulting behavior is dependent on
* what section of `path` you are modifying. If you are modifying the parent (so
* any part before the last `/`), your folder will be moved to that new parent. If
* modifying the name (the part after the last `/`), your folder will be renamed.
*/
path?: pulumi.Input<string>;
/**
* The IDs of any tags to attach to this resource.
*/
tags?: pulumi.Input<pulumi.Input<string>[]>;
/**
* The type of folder to create. Allowed options are
* `datacenter` for datacenter folders, `host` for host and cluster folders,
* `vm` for virtual machine folders, `datastore` for datastore folders, and
* `network` for network folders. Forces a new resource if changed.
*/
type?: pulumi.Input<string>;
}
/**
* The set of arguments for constructing a Folder resource.
*/
export interface FolderArgs {
/**
* Map of custom attribute ids to attribute
* value strings to set for folder. See [here][docs-setting-custom-attributes]
* for a reference on how to set values for custom attributes.
*
* [docs-setting-custom-attributes]: /docs/providers/vsphere/r/custom_attribute.html#using-custom-attributes-in-a-supported-resource
*
* > **NOTE:** Custom attributes are unsupported on direct ESXi connections
* and require vCenter.
*/
customAttributes?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* The ID of the datacenter the folder will be created in.
* Required for all folder types except for datacenter folders. Forces a new
* resource if changed.
*/
datacenterId?: pulumi.Input<string>;
/**
* The path of the folder to be created. This is relative to
* the root of the type of folder you are creating, and the supplied datacenter.
* For example, given a default datacenter of `default-dc`, a folder of type
* `vm` (denoting a virtual machine folder), and a supplied folder of
* `test-folder`, the resulting path would be
* `/default-dc/vm/test-folder`.
*
* > **NOTE:** `path` can be modified - the resulting behavior is dependent on
* what section of `path` you are modifying. If you are modifying the parent (so
* any part before the last `/`), your folder will be moved to that new parent. If
* modifying the name (the part after the last `/`), your folder will be renamed.
*/
path: pulumi.Input<string>;
/**
* The IDs of any tags to attach to this resource.
*/
tags?: pulumi.Input<pulumi.Input<string>[]>;
/**
* The type of folder to create. Allowed options are
* `datacenter` for datacenter folders, `host` for host and cluster folders,
* `vm` for virtual machine folders, `datastore` for datastore folders, and
* `network` for network folders. Forces a new resource if changed.
*/
type: pulumi.Input<string>;
}