Folder
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, datastore folders,
and network folders.
Paths are always relative to the specific type of folder you are creating.
Subfolders are 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 that folder exists.
Example Usage
using Pulumi;
using VSphere = Pulumi.VSphere;
class MyStack : Stack
{
public MyStack()
{
var dc = Output.Create(VSphere.GetDatacenter.InvokeAsync());
var folder = new VSphere.Folder("folder", new VSphere.FolderArgs
{
DatacenterId = dc.Apply(dc => dc.Id),
Path = "test-folder",
Type = "vm",
});
}
}
Coming soon!
import pulumi
import pulumi_vsphere as vsphere
dc = vsphere.get_datacenter()
folder = vsphere.Folder("folder",
datacenter_id=dc.id,
path="test-folder",
type="vm")import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";
const dc = pulumi.output(vsphere.getDatacenter({ async: true }));
const folder = new vsphere.Folder("folder", {
datacenterId: dc.id,
path: "test-folder",
type: "vm",
});Example with subfolders
using Pulumi;
using VSphere = Pulumi.VSphere;
class MyStack : Stack
{
public MyStack()
{
var dc = Output.Create(VSphere.GetDatacenter.InvokeAsync());
var parent = new VSphere.Folder("parent", new VSphere.FolderArgs
{
DatacenterId = dc.Apply(dc => dc.Id),
Path = "test-parent",
Type = "vm",
});
var folder = new VSphere.Folder("folder", new VSphere.FolderArgs
{
DatacenterId = dc.Apply(dc => dc.Id),
Path = parent.Path.Apply(path => $"{path}/test-folder"),
Type = "vm",
});
}
}
Coming soon!
import pulumi
import pulumi_vsphere as vsphere
dc = vsphere.get_datacenter()
parent = vsphere.Folder("parent",
datacenter_id=dc.id,
path="test-parent",
type="vm")
folder = vsphere.Folder("folder",
datacenter_id=dc.id,
path=parent.path.apply(lambda path: f"{path}/test-folder"),
type="vm")import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";
const dc = pulumi.output(vsphere.getDatacenter({ async: true }));
const parent = new vsphere.Folder("parent", {
datacenterId: dc.id,
path: "test-parent",
type: "vm",
});
const folder = new vsphere.Folder("folder", {
datacenterId: dc.id,
path: pulumi.interpolate`${parent.path}/test-folder`,
type: "vm",
});Create a Folder Resource
new Folder(name: string, args: FolderArgs, opts?: CustomResourceOptions);def Folder(resource_name, opts=None, custom_attributes=None, datacenter_id=None, path=None, tags=None, type=None, __props__=None);func NewFolder(ctx *Context, name string, args FolderArgs, opts ...ResourceOption) (*Folder, error)public Folder(string name, FolderArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args FolderArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args FolderArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args FolderArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
Folder Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The Folder resource accepts the following input properties:
- Path 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 typevm(denoting a virtual machine folder), and a supplied folder oftest-folder, the resulting path would be/default-dc/vm/test-folder.- Type string
The type of folder to create. Allowed options are
datacenterfor datacenter folders,hostfor host and cluster folders,vmfor virtual machine folders,datastorefor datastore folders, andnetworkfor network folders. Forces a new resource if changed.- Custom
Attributes Dictionary<string, string> 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.
- Datacenter
Id 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.
- List<string>
The IDs of any tags to attach to this resource.
- Path 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 typevm(denoting a virtual machine folder), and a supplied folder oftest-folder, the resulting path would be/default-dc/vm/test-folder.- Type string
The type of folder to create. Allowed options are
datacenterfor datacenter folders,hostfor host and cluster folders,vmfor virtual machine folders,datastorefor datastore folders, andnetworkfor network folders. Forces a new resource if changed.- Custom
Attributes map[string]string 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.
- Datacenter
Id 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.
- []string
The IDs of any tags to attach to this resource.
- path 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 typevm(denoting a virtual machine folder), and a supplied folder oftest-folder, the resulting path would be/default-dc/vm/test-folder.- type string
The type of folder to create. Allowed options are
datacenterfor datacenter folders,hostfor host and cluster folders,vmfor virtual machine folders,datastorefor datastore folders, andnetworkfor network folders. Forces a new resource if changed.- custom
Attributes {[key: string]: string} 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.
- datacenter
Id 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.
- string[]
The IDs of any tags to attach to this resource.
- path str
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 typevm(denoting a virtual machine folder), and a supplied folder oftest-folder, the resulting path would be/default-dc/vm/test-folder.- type str
The type of folder to create. Allowed options are
datacenterfor datacenter folders,hostfor host and cluster folders,vmfor virtual machine folders,datastorefor datastore folders, andnetworkfor network folders. Forces a new resource if changed.- custom_
attributes Dict[str, str] 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.
- datacenter_
id str 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.
- List[str]
The IDs of any tags to attach to this resource.
Outputs
All input properties are implicitly available as output properties. Additionally, the Folder resource produces the following output properties:
Look up an Existing Folder Resource
Get an existing Folder resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: FolderState, opts?: CustomResourceOptions): Folderstatic get(resource_name, id, opts=None, custom_attributes=None, datacenter_id=None, path=None, tags=None, type=None, __props__=None);func GetFolder(ctx *Context, name string, id IDInput, state *FolderState, opts ...ResourceOption) (*Folder, error)public static Folder Get(string name, Input<string> id, FolderState? state, CustomResourceOptions? opts = null)- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
The following state arguments are supported:
- Custom
Attributes Dictionary<string, string> 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.
- Datacenter
Id 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.
- Path 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 typevm(denoting a virtual machine folder), and a supplied folder oftest-folder, the resulting path would be/default-dc/vm/test-folder.- List<string>
The IDs of any tags to attach to this resource.
- Type string
The type of folder to create. Allowed options are
datacenterfor datacenter folders,hostfor host and cluster folders,vmfor virtual machine folders,datastorefor datastore folders, andnetworkfor network folders. Forces a new resource if changed.
- Custom
Attributes map[string]string 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.
- Datacenter
Id 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.
- Path 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 typevm(denoting a virtual machine folder), and a supplied folder oftest-folder, the resulting path would be/default-dc/vm/test-folder.- []string
The IDs of any tags to attach to this resource.
- Type string
The type of folder to create. Allowed options are
datacenterfor datacenter folders,hostfor host and cluster folders,vmfor virtual machine folders,datastorefor datastore folders, andnetworkfor network folders. Forces a new resource if changed.
- custom
Attributes {[key: string]: string} 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.
- datacenter
Id 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.
- path 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 typevm(denoting a virtual machine folder), and a supplied folder oftest-folder, the resulting path would be/default-dc/vm/test-folder.- string[]
The IDs of any tags to attach to this resource.
- type string
The type of folder to create. Allowed options are
datacenterfor datacenter folders,hostfor host and cluster folders,vmfor virtual machine folders,datastorefor datastore folders, andnetworkfor network folders. Forces a new resource if changed.
- custom_
attributes Dict[str, str] 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.
- datacenter_
id str 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.
- path str
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 typevm(denoting a virtual machine folder), and a supplied folder oftest-folder, the resulting path would be/default-dc/vm/test-folder.- List[str]
The IDs of any tags to attach to this resource.
- type str
The type of folder to create. Allowed options are
datacenterfor datacenter folders,hostfor host and cluster folders,vmfor virtual machine folders,datastorefor datastore folders, andnetworkfor network folders. Forces a new resource if changed.
Package Details
- Repository
- https://github.com/pulumi/pulumi-vsphere
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
vsphereTerraform Provider.