Google Cloud (GCP) Classic

Pulumi Official
Package maintained by Pulumi
v6.32.0 published on Wednesday, Jul 20, 2022 by Pulumi

getOrganization

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)
using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
    public MyStack()
    {
        var org = Output.Create(Gcp.Organizations.GetOrganization.InvokeAsync(new Gcp.Organizations.GetOrganizationArgs
        {
            Domain = "example.com",
        }));
        var sales = new Gcp.Organizations.Folder("sales", new Gcp.Organizations.FolderArgs
        {
            DisplayName = "Sales",
            Parent = org.Apply(org => org.Name),
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v6/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
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

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

    public static void stack(Context ctx) {
        final var org = Output.of(OrganizationsFunctions.getOrganization(GetOrganizationArgs.builder()
            .domain("example.com")
            .build()));

        var sales = new Folder("sales", FolderArgs.builder()        
            .displayName("Sales")
            .parent(org.apply(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 dictionary

The following arguments are supported:

Domain string

The domain name of the Organization.

Organization string

The Organization's numeric ID, including an optional organizations/ prefix.

Domain string

The domain name of the Organization.

Organization string

The Organization's numeric ID, including an optional organizations/ prefix.

domain String

The domain name of the Organization.

organization String

The Organization's numeric ID, including an optional organizations/ prefix.

domain string

The domain name of the Organization.

organization string

The Organization's numeric ID, including an optional organizations/ prefix.

domain str

The domain name of the Organization.

organization str

The Organization's numeric ID, including an optional organizations/ prefix.

domain String

The domain name of the Organization.

organization String

The Organization's numeric ID, including an optional organizations/ prefix.

getOrganization 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".

DirectoryCustomerId string

The Google for Work customer ID of the Organization.

Domain string
Id string

The provider-assigned unique ID for this managed resource.

LifecycleState string

The Organization's current lifecycle state.

Name string

The resource name of the Organization in the form organizations/{organization_id}.

OrgId string

The Organization ID.

Organization string
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".

DirectoryCustomerId string

The Google for Work customer ID of the Organization.

Domain string
Id string

The provider-assigned unique ID for this managed resource.

LifecycleState string

The Organization's current lifecycle state.

Name string

The resource name of the Organization in the form organizations/{organization_id}.

OrgId string

The Organization ID.

Organization string
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".

directoryCustomerId String

The Google for Work customer ID of the Organization.

domain String
id String

The provider-assigned unique ID for this managed resource.

lifecycleState String

The Organization's current lifecycle state.

name String

The resource name of the Organization in the form organizations/{organization_id}.

orgId String

The Organization ID.

organization String
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".

directoryCustomerId string

The Google for Work customer ID of the Organization.

domain string
id string

The provider-assigned unique ID for this managed resource.

lifecycleState string

The Organization's current lifecycle state.

name string

The resource name of the Organization in the form organizations/{organization_id}.

orgId 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_id str

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
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".

directoryCustomerId String

The Google for Work customer ID of the Organization.

domain String
id String

The provider-assigned unique ID for this managed resource.

lifecycleState String

The Organization's current lifecycle state.

name String

The resource name of the Organization in the form organizations/{organization_id}.

orgId String

The Organization ID.

organization String

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.