gcp.organizations.getOrganization
Explore with Pulumi AI
Get information about a Google Cloud Organization. Note that you must have the roles/resourcemanager.organizationViewer role (or equivalent permissions) at the organization level to use this datasource.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const org = gcp.organizations.getOrganization({
    domain: "example.com",
});
const sales = new gcp.organizations.Folder("sales", {
    displayName: "Sales",
    parent: org.then(org => org.name),
});
import pulumi
import pulumi_gcp as gcp
org = gcp.organizations.get_organization(domain="example.com")
sales = gcp.organizations.Folder("sales",
    display_name="Sales",
    parent=org.name)
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 {
		org, err := organizations.GetOrganization(ctx, &organizations.GetOrganizationArgs{
			Domain: pulumi.StringRef("example.com"),
		}, nil)
		if err != nil {
			return err
		}
		_, err = organizations.NewFolder(ctx, "sales", &organizations.FolderArgs{
			DisplayName: pulumi.String("Sales"),
			Parent:      pulumi.String(org.Name),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() => 
{
    var org = Gcp.Organizations.GetOrganization.Invoke(new()
    {
        Domain = "example.com",
    });
    var sales = new Gcp.Organizations.Folder("sales", new()
    {
        DisplayName = "Sales",
        Parent = org.Apply(getOrganizationResult => getOrganizationResult.Name),
    });
});
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.GetOrganizationArgs;
import com.pulumi.gcp.organizations.Folder;
import com.pulumi.gcp.organizations.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 org = OrganizationsFunctions.getOrganization(GetOrganizationArgs.builder()
            .domain("example.com")
            .build());
        var sales = new Folder("sales", FolderArgs.builder()
            .displayName("Sales")
            .parent(org.applyValue(getOrganizationResult -> getOrganizationResult.name()))
            .build());
    }
}
resources:
  sales:
    type: gcp:organizations:Folder
    properties:
      displayName: Sales
      parent: ${org.name}
variables:
  org:
    fn::invoke:
      Function: gcp:organizations:getOrganization
      Arguments:
        domain: example.com
Using getOrganization
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 getOrganization(args: GetOrganizationArgs, opts?: InvokeOptions): Promise<GetOrganizationResult>
function getOrganizationOutput(args: GetOrganizationOutputArgs, opts?: InvokeOptions): Output<GetOrganizationResult>def get_organization(domain: Optional[str] = None,
                     organization: Optional[str] = None,
                     opts: Optional[InvokeOptions] = None) -> GetOrganizationResult
def get_organization_output(domain: Optional[pulumi.Input[str]] = None,
                     organization: Optional[pulumi.Input[str]] = None,
                     opts: Optional[InvokeOptions] = None) -> Output[GetOrganizationResult]func GetOrganization(ctx *Context, args *GetOrganizationArgs, opts ...InvokeOption) (*GetOrganizationResult, error)
func GetOrganizationOutput(ctx *Context, args *GetOrganizationOutputArgs, opts ...InvokeOption) GetOrganizationResultOutput> Note: This function is named GetOrganization in the Go SDK.
public static class GetOrganization 
{
    public static Task<GetOrganizationResult> InvokeAsync(GetOrganizationArgs args, InvokeOptions? opts = null)
    public static Output<GetOrganizationResult> Invoke(GetOrganizationInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetOrganizationResult> getOrganization(GetOrganizationArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: gcp:organizations/getOrganization:getOrganization
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Domain string
 The domain name of the Organization.
NOTE: One of
organizationordomainmust be specified.- Organization string
 - The Organization's numeric ID, including an optional 
organizations/prefix. 
- Domain string
 The domain name of the Organization.
NOTE: One of
organizationordomainmust be specified.- Organization string
 - The Organization's numeric ID, including an optional 
organizations/prefix. 
- domain String
 The domain name of the Organization.
NOTE: One of
organizationordomainmust be specified.- organization String
 - The Organization's numeric ID, including an optional 
organizations/prefix. 
- domain string
 The domain name of the Organization.
NOTE: One of
organizationordomainmust be specified.- organization string
 - The Organization's numeric ID, including an optional 
organizations/prefix. 
- domain str
 The domain name of the Organization.
NOTE: One of
organizationordomainmust be specified.- organization str
 - The Organization's numeric ID, including an optional 
organizations/prefix. 
- domain String
 The domain name of the Organization.
NOTE: One of
organizationordomainmust be specified.- organization String
 - The Organization's numeric ID, including an optional 
organizations/prefix. 
getOrganization 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".
 - Directory
Customer stringId  - The Google for Work customer ID of the Organization.
 - Domain string
 - Id string
 - The provider-assigned unique ID for this managed resource.
 - Lifecycle
State string - The Organization's current lifecycle state.
 - Name string
 - The resource name of the Organization in the form 
organizations/{organization_id}. - Org
Id string - The Organization ID.
 - Organization string
 
- 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".
 - Directory
Customer stringId  - The Google for Work customer ID of the Organization.
 - Domain string
 - Id string
 - The provider-assigned unique ID for this managed resource.
 - Lifecycle
State string - The Organization's current lifecycle state.
 - Name string
 - The resource name of the Organization in the form 
organizations/{organization_id}. - Org
Id string - The Organization ID.
 - Organization string
 
- 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".
 - directory
Customer StringId  - The Google for Work customer ID of the Organization.
 - domain String
 - id String
 - The provider-assigned unique ID for this managed resource.
 - lifecycle
State String - The Organization's current lifecycle state.
 - name String
 - The resource name of the Organization in the form 
organizations/{organization_id}. - org
Id String - The Organization ID.
 - organization String
 
- 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".
 - directory
Customer stringId  - The Google for Work customer ID of the Organization.
 - domain string
 - id string
 - The provider-assigned unique ID for this managed resource.
 - lifecycle
State string - The Organization's current lifecycle state.
 - name string
 - The resource name of the Organization in the form 
organizations/{organization_id}. - org
Id string - The Organization ID.
 - organization string
 
- 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".
 - directory_
customer_ strid  - The Google for Work customer ID of the Organization.
 - domain str
 - id str
 - The provider-assigned unique ID for this managed resource.
 - lifecycle_
state str - The Organization's current lifecycle state.
 - name str
 - The resource name of the Organization in the form 
organizations/{organization_id}. - org_
id str - The Organization ID.
 - organization str
 
- 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".
 - directory
Customer StringId  - The Google for Work customer ID of the Organization.
 - domain String
 - id String
 - The provider-assigned unique ID for this managed resource.
 - lifecycle
State String - The Organization's current lifecycle state.
 - name String
 - The resource name of the Organization in the form 
organizations/{organization_id}. - org
Id String - The Organization ID.
 - organization String
 
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.