1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. organizations
  5. getProject
Google Cloud Classic v7.16.0 published on Wednesday, Mar 27, 2024 by Pulumi

gcp.organizations.getProject

Explore with Pulumi AI

gcp logo
Google Cloud Classic v7.16.0 published on Wednesday, Mar 27, 2024 by Pulumi

    Use this data source to get project details. For more information see API

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const project = gcp.organizations.getProject({});
    export const projectNumber = project.then(project => project.number);
    
    import pulumi
    import pulumi_gcp as gcp
    
    project = gcp.organizations.get_project()
    pulumi.export("projectNumber", project.number)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		project, err := organizations.LookupProject(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("projectNumber", project.Number)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var project = Gcp.Organizations.GetProject.Invoke();
    
        return new Dictionary<string, object?>
        {
            ["projectNumber"] = project.Apply(getProjectResult => getProjectResult.Number),
        };
    });
    
    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.GetProjectArgs;
    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 project = OrganizationsFunctions.getProject();
    
            ctx.export("projectNumber", project.applyValue(getProjectResult -> getProjectResult.number()));
        }
    }
    
    variables:
      project:
        fn::invoke:
          Function: gcp:organizations:getProject
          Arguments: {}
    outputs:
      projectNumber: ${project.number}
    

    Using getProject

    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 getProject(args: GetProjectArgs, opts?: InvokeOptions): Promise<GetProjectResult>
    function getProjectOutput(args: GetProjectOutputArgs, opts?: InvokeOptions): Output<GetProjectResult>
    def get_project(project_id: Optional[str] = None,
                    opts: Optional[InvokeOptions] = None) -> GetProjectResult
    def get_project_output(project_id: Optional[pulumi.Input[str]] = None,
                    opts: Optional[InvokeOptions] = None) -> Output[GetProjectResult]
    func LookupProject(ctx *Context, args *LookupProjectArgs, opts ...InvokeOption) (*LookupProjectResult, error)
    func LookupProjectOutput(ctx *Context, args *LookupProjectOutputArgs, opts ...InvokeOption) LookupProjectResultOutput

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

    public static class GetProject 
    {
        public static Task<GetProjectResult> InvokeAsync(GetProjectArgs args, InvokeOptions? opts = null)
        public static Output<GetProjectResult> Invoke(GetProjectInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetProjectResult> getProject(GetProjectArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: gcp:organizations/getProject:getProject
      arguments:
        # arguments dictionary

    The following arguments are supported:

    ProjectId string
    The project ID. If it is not provided, the provider project is used.
    ProjectId string
    The project ID. If it is not provided, the provider project is used.
    projectId String
    The project ID. If it is not provided, the provider project is used.
    projectId string
    The project ID. If it is not provided, the provider project is used.
    project_id str
    The project ID. If it is not provided, the provider project is used.
    projectId String
    The project ID. If it is not provided, the provider project is used.

    getProject Result

    The following output properties are available:

    AutoCreateNetwork bool
    BillingAccount string
    EffectiveLabels Dictionary<string, string>
    FolderId string
    Id string
    The provider-assigned unique ID for this managed resource.
    Labels Dictionary<string, string>
    Name string
    Number string
    The numeric identifier of the project.
    OrgId string
    PulumiLabels Dictionary<string, string>
    SkipDelete bool
    ProjectId string
    AutoCreateNetwork bool
    BillingAccount string
    EffectiveLabels map[string]string
    FolderId string
    Id string
    The provider-assigned unique ID for this managed resource.
    Labels map[string]string
    Name string
    Number string
    The numeric identifier of the project.
    OrgId string
    PulumiLabels map[string]string
    SkipDelete bool
    ProjectId string
    autoCreateNetwork Boolean
    billingAccount String
    effectiveLabels Map<String,String>
    folderId String
    id String
    The provider-assigned unique ID for this managed resource.
    labels Map<String,String>
    name String
    number String
    The numeric identifier of the project.
    orgId String
    pulumiLabels Map<String,String>
    skipDelete Boolean
    projectId String
    autoCreateNetwork boolean
    billingAccount string
    effectiveLabels {[key: string]: string}
    folderId string
    id string
    The provider-assigned unique ID for this managed resource.
    labels {[key: string]: string}
    name string
    number string
    The numeric identifier of the project.
    orgId string
    pulumiLabels {[key: string]: string}
    skipDelete boolean
    projectId string
    auto_create_network bool
    billing_account str
    effective_labels Mapping[str, str]
    folder_id str
    id str
    The provider-assigned unique ID for this managed resource.
    labels Mapping[str, str]
    name str
    number str
    The numeric identifier of the project.
    org_id str
    pulumi_labels Mapping[str, str]
    skip_delete bool
    project_id str
    autoCreateNetwork Boolean
    billingAccount String
    effectiveLabels Map<String>
    folderId String
    id String
    The provider-assigned unique ID for this managed resource.
    labels Map<String>
    name String
    number String
    The numeric identifier of the project.
    orgId String
    pulumiLabels Map<String>
    skipDelete Boolean
    projectId String

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the google-beta Terraform Provider.
    gcp logo
    Google Cloud Classic v7.16.0 published on Wednesday, Mar 27, 2024 by Pulumi