Google Cloud Classic v8.3.1 published on Wednesday, Sep 25, 2024 by Pulumi
gcp.organizations.getFolder
Explore with Pulumi AI
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)
package main
import (
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/organizations"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		myFolder1, err := organizations.LookupFolder(ctx, &organizations.LookupFolderArgs{
			Folder:             "folders/12345",
			LookupOrganization: pulumi.BoolRef(true),
		}, 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 System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() => 
{
    var myFolder1 = Gcp.Organizations.GetFolder.Invoke(new()
    {
        Folder = "folders/12345",
        LookupOrganization = true,
    });
    var myFolder2 = Gcp.Organizations.GetFolder.Invoke(new()
    {
        Folder = "folders/23456",
    });
    return new Dictionary<string, object?>
    {
        ["myFolder1Organization"] = myFolder1.Apply(getFolderResult => getFolderResult.Organization),
        ["myFolder2Parent"] = myFolder2.Apply(getFolderResult => getFolderResult.Parent),
    };
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.OrganizationsFunctions;
import com.pulumi.gcp.organizations.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 myFolder1 = OrganizationsFunctions.getFolder(GetFolderArgs.builder()
            .folder("folders/12345")
            .lookupOrganization(true)
            .build());
        final var myFolder2 = OrganizationsFunctions.getFolder(GetFolderArgs.builder()
            .folder("folders/23456")
            .build());
        ctx.export("myFolder1Organization", myFolder1.applyValue(getFolderResult -> getFolderResult.organization()));
        ctx.export("myFolder2Parent", myFolder2.applyValue(getFolderResult -> getFolderResult.parent()));
    }
}
variables:
  myFolder1:
    fn::invoke:
      Function: gcp:organizations:getFolder
      Arguments:
        folder: folders/12345
        lookupOrganization: true
  myFolder2:
    fn::invoke:
      Function: gcp:organizations:getFolder
      Arguments:
        folder: folders/23456
outputs:
  myFolder1Organization: ${myFolder1.organization}
  myFolder2Parent: ${myFolder2.parent}
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>def get_folder(folder: Optional[str] = None,
               lookup_organization: Optional[bool] = None,
               opts: Optional[InvokeOptions] = None) -> GetFolderResult
def get_folder_output(folder: Optional[pulumi.Input[str]] = None,
               lookup_organization: Optional[pulumi.Input[bool]] = None,
               opts: Optional[InvokeOptions] = None) -> Output[GetFolderResult]func LookupFolder(ctx *Context, args *LookupFolderArgs, opts ...InvokeOption) (*LookupFolderResult, error)
func LookupFolderOutput(ctx *Context, args *LookupFolderOutputArgs, opts ...InvokeOption) LookupFolderResultOutput> 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)
}public static CompletableFuture<GetFolderResult> getFolder(GetFolderArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: gcp:organizations/getFolder:getFolder
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Folder string
 - The name of the Folder in the form 
{folder_id}orfolders/{folder_id}. - Lookup
Organization bool trueto find the organization that the folder belongs,falseto avoid the lookup. It searches up the tree. (defaults tofalse)
- Folder string
 - The name of the Folder in the form 
{folder_id}orfolders/{folder_id}. - Lookup
Organization bool trueto find the organization that the folder belongs,falseto avoid the lookup. It searches up the tree. (defaults tofalse)
- folder String
 - The name of the Folder in the form 
{folder_id}orfolders/{folder_id}. - lookup
Organization Boolean trueto find the organization that the folder belongs,falseto avoid the lookup. It searches up the tree. (defaults tofalse)
- folder string
 - The name of the Folder in the form 
{folder_id}orfolders/{folder_id}. - lookup
Organization boolean trueto find the organization that the folder belongs,falseto avoid the lookup. It searches up the tree. (defaults tofalse)
- folder str
 - The name of the Folder in the form 
{folder_id}orfolders/{folder_id}. - lookup_
organization bool trueto find the organization that the folder belongs,falseto avoid the lookup. It searches up the tree. (defaults tofalse)
- folder String
 - The name of the Folder in the form 
{folder_id}orfolders/{folder_id}. - lookup
Organization Boolean trueto find the organization that the folder belongs,falseto avoid the lookup. It searches up the tree. (defaults tofalse)
getFolder Result
The following output properties are available:
- Create
Time string - Timestamp when the Organization was created. A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z".
 - Deletion
Protection bool - Display
Name string - The folder's display name.
 - Folder string
 - Folder
Id string - Id string
 - The provider-assigned unique ID for this managed resource.
 - Lifecycle
State 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_organizationis enable, the resource name of the Organization that the folder belongs. - Parent string
 - The resource name of the parent Folder or Organization.
 - Lookup
Organization bool 
- Create
Time string - Timestamp when the Organization was created. A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z".
 - Deletion
Protection bool - Display
Name string - The folder's display name.
 - Folder string
 - Folder
Id string - Id string
 - The provider-assigned unique ID for this managed resource.
 - Lifecycle
State 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_organizationis enable, the resource name of the Organization that the folder belongs. - Parent string
 - The resource name of the parent Folder or Organization.
 - Lookup
Organization bool 
- create
Time String - Timestamp when the Organization was created. A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z".
 - deletion
Protection Boolean - display
Name String - The folder's display name.
 - folder String
 - folder
Id String - id String
 - The provider-assigned unique ID for this managed resource.
 - lifecycle
State 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_organizationis enable, the resource name of the Organization that the folder belongs. - parent String
 - The resource name of the parent Folder or Organization.
 - lookup
Organization Boolean 
- create
Time string - Timestamp when the Organization was created. A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z".
 - deletion
Protection boolean - display
Name string - The folder's display name.
 - folder string
 - folder
Id string - id string
 - The provider-assigned unique ID for this managed resource.
 - lifecycle
State 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_organizationis enable, the resource name of the Organization that the folder belongs. - parent string
 - The resource name of the parent Folder or Organization.
 - lookup
Organization 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".
 - deletion_
protection bool - 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_organizationis 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 
- create
Time String - Timestamp when the Organization was created. A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z".
 - deletion
Protection Boolean - display
Name String - The folder's display name.
 - folder String
 - folder
Id String - id String
 - The provider-assigned unique ID for this managed resource.
 - lifecycle
State 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_organizationis enable, the resource name of the Organization that the folder belongs. - parent String
 - The resource name of the parent Folder or Organization.
 - lookup
Organization Boolean 
Package Details
- Repository
 - Google Cloud (GCP) Classic pulumi/pulumi-gcp
 - License
 - Apache-2.0
 - Notes
 - This Pulumi package is based on the 
google-betaTerraform Provider.