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

vsphere.getFolder

Explore with Pulumi AI

vSphere v4.13.2 published on Wednesday, Apr 9, 2025 by Pulumi

The vsphere.Folder data source can be used to get the general attributes of a vSphere inventory folder. The data source supports creating folders of the 5 major types - datacenter folders, host and cluster folders, virtual machine folders, storage folders, and network folders.

Paths are absolute and must include the datacenter.

Example Usage

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

const folder = vsphere.getFolder({
    path: "/dc-01/datastore-01/folder-01",
});
Copy
import pulumi
import pulumi_vsphere as vsphere

folder = vsphere.get_folder(path="/dc-01/datastore-01/folder-01")
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 {
		_, err := vsphere.LookupFolder(ctx, &vsphere.LookupFolderArgs{
			Path: "/dc-01/datastore-01/folder-01",
		}, nil)
		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 folder = VSphere.GetFolder.Invoke(new()
    {
        Path = "/dc-01/datastore-01/folder-01",
    });

});
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.GetFolderArgs;
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 folder = VsphereFunctions.getFolder(GetFolderArgs.builder()
            .path("/dc-01/datastore-01/folder-01")
            .build());

    }
}
Copy
variables:
  folder:
    fn::invoke:
      function: vsphere:getFolder
      arguments:
        path: /dc-01/datastore-01/folder-01
Copy

Using getFolder

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getFolder(args: GetFolderArgs, opts?: InvokeOptions): Promise<GetFolderResult>
function getFolderOutput(args: GetFolderOutputArgs, opts?: InvokeOptions): Output<GetFolderResult>
Copy
def get_folder(path: Optional[str] = None,
               opts: Optional[InvokeOptions] = None) -> GetFolderResult
def get_folder_output(path: Optional[pulumi.Input[str]] = None,
               opts: Optional[InvokeOptions] = None) -> Output[GetFolderResult]
Copy
func LookupFolder(ctx *Context, args *LookupFolderArgs, opts ...InvokeOption) (*LookupFolderResult, error)
func LookupFolderOutput(ctx *Context, args *LookupFolderOutputArgs, opts ...InvokeOption) LookupFolderResultOutput
Copy

> Note: This function is named LookupFolder in the Go SDK.

public static class GetFolder 
{
    public static Task<GetFolderResult> InvokeAsync(GetFolderArgs args, InvokeOptions? opts = null)
    public static Output<GetFolderResult> Invoke(GetFolderInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetFolderResult> getFolder(GetFolderArgs args, InvokeOptions options)
public static Output<GetFolderResult> getFolder(GetFolderArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: vsphere:index/getFolder:getFolder
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Path This property is required. string
The absolute path of the folder. For example, given a default datacenter of default-dc, a folder of type vm, and a folder name of test-folder, the resulting path would be /default-dc/vm/test-folder. The valid folder types to be used in the path are: vm, host, datacenter, datastore, or network.
Path This property is required. string
The absolute path of the folder. For example, given a default datacenter of default-dc, a folder of type vm, and a folder name of test-folder, the resulting path would be /default-dc/vm/test-folder. The valid folder types to be used in the path are: vm, host, datacenter, datastore, or network.
path This property is required. String
The absolute path of the folder. For example, given a default datacenter of default-dc, a folder of type vm, and a folder name of test-folder, the resulting path would be /default-dc/vm/test-folder. The valid folder types to be used in the path are: vm, host, datacenter, datastore, or network.
path This property is required. string
The absolute path of the folder. For example, given a default datacenter of default-dc, a folder of type vm, and a folder name of test-folder, the resulting path would be /default-dc/vm/test-folder. The valid folder types to be used in the path are: vm, host, datacenter, datastore, or network.
path This property is required. str
The absolute path of the folder. For example, given a default datacenter of default-dc, a folder of type vm, and a folder name of test-folder, the resulting path would be /default-dc/vm/test-folder. The valid folder types to be used in the path are: vm, host, datacenter, datastore, or network.
path This property is required. String
The absolute path of the folder. For example, given a default datacenter of default-dc, a folder of type vm, and a folder name of test-folder, the resulting path would be /default-dc/vm/test-folder. The valid folder types to be used in the path are: vm, host, datacenter, datastore, or network.

getFolder Result

The following output properties are available:

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

Package Details

Repository
vSphere pulumi/pulumi-vsphere
License
Apache-2.0
Notes
This Pulumi package is based on the vsphere Terraform Provider.
vSphere v4.13.2 published on Wednesday, Apr 9, 2025 by Pulumi