getFolder

Use this data source to get information about a Google Cloud Folder.

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

const myFolder1 = gcp.organizations.getFolder({
    folder: "folders/12345",
    lookupOrganization: true,
});
const myFolder2 = gcp.organizations.getFolder({
    folder: "folders/23456",
});
export const myFolder1Organization = myFolder1.then(myFolder1 => myFolder1.organization);
export const myFolder2Parent = myFolder2.then(myFolder2 => myFolder2.parent);
import pulumi
import pulumi_gcp as gcp

my_folder1 = gcp.organizations.get_folder(folder="folders/12345",
    lookup_organization=True)
my_folder2 = gcp.organizations.get_folder(folder="folders/23456")
pulumi.export("myFolder1Organization", my_folder1.organization)
pulumi.export("myFolder2Parent", my_folder2.parent)
using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
    public MyStack()
    {
        var myFolder1 = Output.Create(Gcp.Organizations.GetFolder.InvokeAsync(new Gcp.Organizations.GetFolderArgs
        {
            Folder = "folders/12345",
            LookupOrganization = true,
        }));
        var myFolder2 = Output.Create(Gcp.Organizations.GetFolder.InvokeAsync(new Gcp.Organizations.GetFolderArgs
        {
            Folder = "folders/23456",
        }));
        this.MyFolder1Organization = myFolder1.Apply(myFolder1 => myFolder1.Organization);
        this.MyFolder2Parent = myFolder2.Apply(myFolder2 => myFolder2.Parent);
    }

    [Output("myFolder1Organization")]
    public Output<string> MyFolder1Organization { get; set; }
    [Output("myFolder2Parent")]
    public Output<string> MyFolder2Parent { get; set; }
}
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v5/go/gcp/organizations"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		opt0 := true
		myFolder1, err := organizations.LookupFolder(ctx, &organizations.LookupFolderArgs{
			Folder:             "folders/12345",
			LookupOrganization: &opt0,
		}, nil)
		if err != nil {
			return err
		}
		myFolder2, err := organizations.LookupFolder(ctx, &organizations.LookupFolderArgs{
			Folder: "folders/23456",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("myFolder1Organization", myFolder1.Organization)
		ctx.Export("myFolder2Parent", myFolder2.Parent)
		return nil
	})
}

Using getFolder

function getFolder(args: GetFolderArgs, opts?: InvokeOptions): Promise<GetFolderResult>
def get_folder(folder: Optional[str] = None,
               lookup_organization: Optional[bool] = None,
               opts: Optional[InvokeOptions] = None) -> GetFolderResult
func LookupFolder(ctx *Context, args *LookupFolderArgs, opts ...InvokeOption) (*LookupFolderResult, error)

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

public static class GetFolder {
    public static Task<GetFolderResult> InvokeAsync(GetFolderArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

Folder string
The name of the Folder in the form {folder_id} or folders/{folder_id}.
LookupOrganization bool
true to find the organization that the folder belongs, false to avoid the lookup. It searches up the tree. (defaults to false)
Folder string
The name of the Folder in the form {folder_id} or folders/{folder_id}.
LookupOrganization bool
true to find the organization that the folder belongs, false to avoid the lookup. It searches up the tree. (defaults to false)
folder string
The name of the Folder in the form {folder_id} or folders/{folder_id}.
lookupOrganization boolean
true to find the organization that the folder belongs, false to avoid the lookup. It searches up the tree. (defaults to false)
folder str
The name of the Folder in the form {folder_id} or folders/{folder_id}.
lookup_organization bool
true to find the organization that the folder belongs, false to avoid the lookup. It searches up the tree. (defaults to false)

getFolder Result

The following output properties are available:

CreateTime string
Timestamp when the Organization was created. A timestamp in RFC3339 UTC “Zulu” format, accurate to nanoseconds. Example: “2014-10-02T15:01:23.045123456Z”.
DisplayName string
The folder’s display name.
Folder string
FolderId string
Id string
The provider-assigned unique ID for this managed resource.
LifecycleState string
The Folder’s current lifecycle state.
Name string
The resource name of the Folder in the form folders/{folder_id}.
Organization string
If lookup_organization is enable, the resource name of the Organization that the folder belongs.
Parent string
The resource name of the parent Folder or Organization.
LookupOrganization bool
CreateTime string
Timestamp when the Organization was created. A timestamp in RFC3339 UTC “Zulu” format, accurate to nanoseconds. Example: “2014-10-02T15:01:23.045123456Z”.
DisplayName string
The folder’s display name.
Folder string
FolderId string
Id string
The provider-assigned unique ID for this managed resource.
LifecycleState string
The Folder’s current lifecycle state.
Name string
The resource name of the Folder in the form folders/{folder_id}.
Organization string
If lookup_organization is enable, the resource name of the Organization that the folder belongs.
Parent string
The resource name of the parent Folder or Organization.
LookupOrganization bool
createTime string
Timestamp when the Organization was created. A timestamp in RFC3339 UTC “Zulu” format, accurate to nanoseconds. Example: “2014-10-02T15:01:23.045123456Z”.
displayName string
The folder’s display name.
folder string
folderId string
id string
The provider-assigned unique ID for this managed resource.
lifecycleState string
The Folder’s current lifecycle state.
name string
The resource name of the Folder in the form folders/{folder_id}.
organization string
If lookup_organization is enable, the resource name of the Organization that the folder belongs.
parent string
The resource name of the parent Folder or Organization.
lookupOrganization boolean
create_time str
Timestamp when the Organization was created. A timestamp in RFC3339 UTC “Zulu” format, accurate to nanoseconds. Example: “2014-10-02T15:01:23.045123456Z”.
display_name str
The folder’s display name.
folder str
folder_id str
id str
The provider-assigned unique ID for this managed resource.
lifecycle_state str
The Folder’s current lifecycle state.
name str
The resource name of the Folder in the form folders/{folder_id}.
organization str
If lookup_organization is enable, the resource name of the Organization that the folder belongs.
parent str
The resource name of the parent Folder or Organization.
lookup_organization bool

Package Details

Repository
https://github.com/pulumi/pulumi-gcp
License
Apache-2.0
Notes
This Pulumi package is based on the google-beta Terraform Provider.