1. Packages
  2. Vsphere Provider
  3. API Docs
  4. Folder
vSphere v4.13.2 published on Wednesday, Apr 9, 2025 by Pulumi

vsphere.Folder

Explore with Pulumi AI

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 that folder exists.

Example Usage

The basic example below creates a virtual machine folder named test-folder in the default datacenter’s VM hierarchy.

import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";

const datacenter = vsphere.getDatacenter({});
const folder = new vsphere.Folder("folder", {
    path: "test-folder",
    type: "vm",
    datacenterId: datacenter.then(datacenter => datacenter.id),
});
Copy
import pulumi
import pulumi_vsphere as vsphere

datacenter = vsphere.get_datacenter()
folder = vsphere.Folder("folder",
    path="test-folder",
    type="vm",
    datacenter_id=datacenter.id)
Copy
package main

import (
	"github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		datacenter, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{}, nil)
		if err != nil {
			return err
		}
		_, err = vsphere.NewFolder(ctx, "folder", &vsphere.FolderArgs{
			Path:         pulumi.String("test-folder"),
			Type:         pulumi.String("vm"),
			DatacenterId: pulumi.String(datacenter.Id),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using VSphere = Pulumi.VSphere;

return await Deployment.RunAsync(() => 
{
    var datacenter = VSphere.GetDatacenter.Invoke();

    var folder = new VSphere.Folder("folder", new()
    {
        Path = "test-folder",
        Type = "vm",
        DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id),
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.vsphere.VsphereFunctions;
import com.pulumi.vsphere.inputs.GetDatacenterArgs;
import com.pulumi.vsphere.Folder;
import com.pulumi.vsphere.FolderArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var datacenter = VsphereFunctions.getDatacenter(GetDatacenterArgs.builder()
            .build());

        var folder = new Folder("folder", FolderArgs.builder()
            .path("test-folder")
            .type("vm")
            .datacenterId(datacenter.id())
            .build());

    }
}
Copy
resources:
  folder:
    type: vsphere:Folder
    properties:
      path: test-folder
      type: vm
      datacenterId: ${datacenter.id}
variables:
  datacenter:
    fn::invoke:
      function: vsphere:getDatacenter
      arguments: {}
Copy

Example with subfolders

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.

import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";

const datacenter = vsphere.getDatacenter({});
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),
});
Copy
import pulumi
import pulumi_vsphere as vsphere

datacenter = vsphere.get_datacenter()
parent = vsphere.Folder("parent",
    path="test-parent",
    type="vm",
    datacenter_id=datacenter.id)
folder = vsphere.Folder("folder",
    path=parent.path.apply(lambda path: f"{path}/test-folder"),
    type="vm",
    datacenter_id=datacenter.id)
Copy
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		datacenter, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{}, nil)
		if err != nil {
			return err
		}
		parent, err := vsphere.NewFolder(ctx, "parent", &vsphere.FolderArgs{
			Path:         pulumi.String("test-parent"),
			Type:         pulumi.String("vm"),
			DatacenterId: pulumi.String(datacenter.Id),
		})
		if err != nil {
			return err
		}
		_, err = vsphere.NewFolder(ctx, "folder", &vsphere.FolderArgs{
			Path: parent.Path.ApplyT(func(path string) (string, error) {
				return fmt.Sprintf("%v/test-folder", path), nil
			}).(pulumi.StringOutput),
			Type:         pulumi.String("vm"),
			DatacenterId: pulumi.String(datacenter.Id),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using VSphere = Pulumi.VSphere;

return await Deployment.RunAsync(() => 
{
    var datacenter = VSphere.GetDatacenter.Invoke();

    var parent = new VSphere.Folder("parent", new()
    {
        Path = "test-parent",
        Type = "vm",
        DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id),
    });

    var folder = new VSphere.Folder("folder", new()
    {
        Path = parent.Path.Apply(path => $"{path}/test-folder"),
        Type = "vm",
        DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id),
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.vsphere.VsphereFunctions;
import com.pulumi.vsphere.inputs.GetDatacenterArgs;
import com.pulumi.vsphere.Folder;
import com.pulumi.vsphere.FolderArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var datacenter = VsphereFunctions.getDatacenter(GetDatacenterArgs.builder()
            .build());

        var parent = new Folder("parent", FolderArgs.builder()
            .path("test-parent")
            .type("vm")
            .datacenterId(datacenter.id())
            .build());

        var folder = new Folder("folder", FolderArgs.builder()
            .path(parent.path().applyValue(_path -> String.format("%s/test-folder", _path)))
            .type("vm")
            .datacenterId(datacenter.id())
            .build());

    }
}
Copy
resources:
  parent:
    type: vsphere:Folder
    properties:
      path: test-parent
      type: vm
      datacenterId: ${datacenter.id}
  folder:
    type: vsphere:Folder
    properties:
      path: ${parent.path}/test-folder
      type: vm
      datacenterId: ${datacenter.id}
variables:
  datacenter:
    fn::invoke:
      function: vsphere:getDatacenter
      arguments: {}
Copy

Create Folder Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new Folder(name: string, args: FolderArgs, opts?: CustomResourceOptions);
@overload
def Folder(resource_name: str,
           args: FolderArgs,
           opts: Optional[ResourceOptions] = None)

@overload
def Folder(resource_name: str,
           opts: Optional[ResourceOptions] = None,
           path: Optional[str] = None,
           type: Optional[str] = None,
           custom_attributes: Optional[Mapping[str, str]] = None,
           datacenter_id: Optional[str] = None,
           tags: Optional[Sequence[str]] = None)
func NewFolder(ctx *Context, name string, args FolderArgs, opts ...ResourceOption) (*Folder, error)
public Folder(string name, FolderArgs args, CustomResourceOptions? opts = null)
public Folder(String name, FolderArgs args)
public Folder(String name, FolderArgs args, CustomResourceOptions options)
type: vsphere:Folder
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. FolderArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. FolderArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. FolderArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. FolderArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. FolderArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var folderResource = new VSphere.Folder("folderResource", new()
{
    Path = "string",
    Type = "string",
    CustomAttributes = 
    {
        { "string", "string" },
    },
    DatacenterId = "string",
    Tags = new[]
    {
        "string",
    },
});
Copy
example, err := vsphere.NewFolder(ctx, "folderResource", &vsphere.FolderArgs{
	Path: pulumi.String("string"),
	Type: pulumi.String("string"),
	CustomAttributes: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	DatacenterId: pulumi.String("string"),
	Tags: pulumi.StringArray{
		pulumi.String("string"),
	},
})
Copy
var folderResource = new Folder("folderResource", FolderArgs.builder()
    .path("string")
    .type("string")
    .customAttributes(Map.of("string", "string"))
    .datacenterId("string")
    .tags("string")
    .build());
Copy
folder_resource = vsphere.Folder("folderResource",
    path="string",
    type="string",
    custom_attributes={
        "string": "string",
    },
    datacenter_id="string",
    tags=["string"])
Copy
const folderResource = new vsphere.Folder("folderResource", {
    path: "string",
    type: "string",
    customAttributes: {
        string: "string",
    },
    datacenterId: "string",
    tags: ["string"],
});
Copy
type: vsphere:Folder
properties:
    customAttributes:
        string: string
    datacenterId: string
    path: string
    tags:
        - string
    type: string
Copy

Folder Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The Folder resource accepts the following input properties:

Path This property is required. 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.

Type
This property is required.
Changes to this property will trigger replacement.
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.
CustomAttributes Dictionary<string, string>

Map of custom attribute ids to attribute value strings to set for folder. See here for a reference on how to set values for custom attributes.

NOTE: Custom attributes are unsupported on direct ESXi connections and require vCenter.

DatacenterId Changes to this property will trigger replacement. 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.
Tags List<string>
The IDs of any tags to attach to this resource.
Path This property is required. 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.

Type
This property is required.
Changes to this property will trigger replacement.
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.
CustomAttributes map[string]string

Map of custom attribute ids to attribute value strings to set for folder. See here for a reference on how to set values for custom attributes.

NOTE: Custom attributes are unsupported on direct ESXi connections and require vCenter.

DatacenterId Changes to this property will trigger replacement. 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.
Tags []string
The IDs of any tags to attach to this resource.
path This property is required. 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.

type
This property is required.
Changes to this property will trigger replacement.
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.
customAttributes Map<String,String>

Map of custom attribute ids to attribute value strings to set for folder. See here for a reference on how to set values for custom attributes.

NOTE: Custom attributes are unsupported on direct ESXi connections and require vCenter.

datacenterId Changes to this property will trigger replacement. 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.
tags List<String>
The IDs of any tags to attach to this resource.
path This property is required. 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.

type
This property is required.
Changes to this property will trigger replacement.
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.
customAttributes {[key: string]: string}

Map of custom attribute ids to attribute value strings to set for folder. See here for a reference on how to set values for custom attributes.

NOTE: Custom attributes are unsupported on direct ESXi connections and require vCenter.

datacenterId Changes to this property will trigger replacement. 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.
tags string[]
The IDs of any tags to attach to this resource.
path This property is required. 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 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.

type
This property is required.
Changes to this property will trigger replacement.
str
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.
custom_attributes Mapping[str, str]

Map of custom attribute ids to attribute value strings to set for folder. See here for a reference on how to set values for custom attributes.

NOTE: Custom attributes are unsupported on direct ESXi connections and require vCenter.

datacenter_id Changes to this property will trigger replacement. 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.
tags Sequence[str]
The IDs of any tags to attach to this resource.
path This property is required. 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.

type
This property is required.
Changes to this property will trigger replacement.
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.
customAttributes Map<String>

Map of custom attribute ids to attribute value strings to set for folder. See here for a reference on how to set values for custom attributes.

NOTE: Custom attributes are unsupported on direct ESXi connections and require vCenter.

datacenterId Changes to this property will trigger replacement. 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.
tags List<String>
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:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up 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): Folder
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        custom_attributes: Optional[Mapping[str, str]] = None,
        datacenter_id: Optional[str] = None,
        path: Optional[str] = None,
        tags: Optional[Sequence[str]] = None,
        type: Optional[str] = None) -> Folder
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)
public static Folder get(String name, Output<String> id, FolderState state, CustomResourceOptions options)
resources:  _:    type: vsphere:Folder    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
CustomAttributes Dictionary<string, string>

Map of custom attribute ids to attribute value strings to set for folder. See here for a reference on how to set values for custom attributes.

NOTE: Custom attributes are unsupported on direct ESXi connections and require vCenter.

DatacenterId Changes to this property will trigger replacement. 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 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.

Tags List<string>
The IDs of any tags to attach to this resource.
Type Changes to this property will trigger replacement. 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.
CustomAttributes map[string]string

Map of custom attribute ids to attribute value strings to set for folder. See here for a reference on how to set values for custom attributes.

NOTE: Custom attributes are unsupported on direct ESXi connections and require vCenter.

DatacenterId Changes to this property will trigger replacement. 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 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.

Tags []string
The IDs of any tags to attach to this resource.
Type Changes to this property will trigger replacement. 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.
customAttributes Map<String,String>

Map of custom attribute ids to attribute value strings to set for folder. See here for a reference on how to set values for custom attributes.

NOTE: Custom attributes are unsupported on direct ESXi connections and require vCenter.

datacenterId Changes to this property will trigger replacement. 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 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.

tags List<String>
The IDs of any tags to attach to this resource.
type Changes to this property will trigger replacement. 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.
customAttributes {[key: string]: string}

Map of custom attribute ids to attribute value strings to set for folder. See here for a reference on how to set values for custom attributes.

NOTE: Custom attributes are unsupported on direct ESXi connections and require vCenter.

datacenterId Changes to this property will trigger replacement. 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 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.

tags string[]
The IDs of any tags to attach to this resource.
type Changes to this property will trigger replacement. 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.
custom_attributes Mapping[str, str]

Map of custom attribute ids to attribute value strings to set for folder. See here for a reference on how to set values for custom attributes.

NOTE: Custom attributes are unsupported on direct ESXi connections and require vCenter.

datacenter_id Changes to this property will trigger replacement. 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 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.

tags Sequence[str]
The IDs of any tags to attach to this resource.
type Changes to this property will trigger replacement. str
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.
customAttributes Map<String>

Map of custom attribute ids to attribute value strings to set for folder. See here for a reference on how to set values for custom attributes.

NOTE: Custom attributes are unsupported on direct ESXi connections and require vCenter.

datacenterId Changes to this property will trigger replacement. 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 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.

tags List<String>
The IDs of any tags to attach to this resource.
type Changes to this property will trigger replacement. 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.

Import

An existing folder can be imported into this resource via

its full path, via the following command:

$ pulumi import vsphere:index/folder:Folder folder /default-dc/vm/terraform-test-folder
Copy

The above command would import the folder from our examples above, the VM

folder named terraform-test-folder located in the datacenter named

default-dc.

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
vSphere pulumi/pulumi-vsphere
License
Apache-2.0
Notes
This Pulumi package is based on the vsphere Terraform Provider.