1. Packages
  2. Harness Provider
  3. API Docs
  4. platform
  5. getGcpProjects
Harness v0.11.0 published on Saturday, Jan 24, 2026 by Pulumi
harness logo
Harness v0.11.0 published on Saturday, Jan 24, 2026 by Pulumi

    Data source for listing GCP projects using a cloud connector identifier or secret manager connector identifier.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as harness from "@pulumi/harness";
    
    // Example: List GCP projects using a GCP cloud connector
    const example = harness.platform.getGcpProjects({
        connectorId: "my_gcp_connector",
    });
    // Example: List GCP projects using a GCP secret manager connector
    const exampleSecretManager = harness.platform.getGcpProjects({
        connectorId: "my_gcp_secret_manager_connector",
    });
    // Example: List GCP projects with org and project scope
    const exampleScoped = harness.platform.getGcpProjects({
        connectorId: "my_gcp_connector",
        orgId: "my_org",
        projectId: "my_project",
    });
    export const gcpProjects = example.then(example => example.projects);
    
    import pulumi
    import pulumi_harness as harness
    
    # Example: List GCP projects using a GCP cloud connector
    example = harness.platform.get_gcp_projects(connector_id="my_gcp_connector")
    # Example: List GCP projects using a GCP secret manager connector
    example_secret_manager = harness.platform.get_gcp_projects(connector_id="my_gcp_secret_manager_connector")
    # Example: List GCP projects with org and project scope
    example_scoped = harness.platform.get_gcp_projects(connector_id="my_gcp_connector",
        org_id="my_org",
        project_id="my_project")
    pulumi.export("gcpProjects", example.projects)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-harness/sdk/go/harness/platform"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Example: List GCP projects using a GCP cloud connector
    		example, err := platform.GetGcpProjects(ctx, &platform.GetGcpProjectsArgs{
    			ConnectorId: "my_gcp_connector",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		// Example: List GCP projects using a GCP secret manager connector
    		_, err = platform.GetGcpProjects(ctx, &platform.GetGcpProjectsArgs{
    			ConnectorId: "my_gcp_secret_manager_connector",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		// Example: List GCP projects with org and project scope
    		_, err = platform.GetGcpProjects(ctx, &platform.GetGcpProjectsArgs{
    			ConnectorId: "my_gcp_connector",
    			OrgId:       pulumi.StringRef("my_org"),
    			ProjectId:   pulumi.StringRef("my_project"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("gcpProjects", example.Projects)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Harness = Pulumi.Harness;
    
    return await Deployment.RunAsync(() => 
    {
        // Example: List GCP projects using a GCP cloud connector
        var example = Harness.Platform.GetGcpProjects.Invoke(new()
        {
            ConnectorId = "my_gcp_connector",
        });
    
        // Example: List GCP projects using a GCP secret manager connector
        var exampleSecretManager = Harness.Platform.GetGcpProjects.Invoke(new()
        {
            ConnectorId = "my_gcp_secret_manager_connector",
        });
    
        // Example: List GCP projects with org and project scope
        var exampleScoped = Harness.Platform.GetGcpProjects.Invoke(new()
        {
            ConnectorId = "my_gcp_connector",
            OrgId = "my_org",
            ProjectId = "my_project",
        });
    
        return new Dictionary<string, object?>
        {
            ["gcpProjects"] = example.Apply(getGcpProjectsResult => getGcpProjectsResult.Projects),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.harness.platform.PlatformFunctions;
    import com.pulumi.harness.platform.inputs.GetGcpProjectsArgs;
    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) {
            // Example: List GCP projects using a GCP cloud connector
            final var example = PlatformFunctions.getGcpProjects(GetGcpProjectsArgs.builder()
                .connectorId("my_gcp_connector")
                .build());
    
            // Example: List GCP projects using a GCP secret manager connector
            final var exampleSecretManager = PlatformFunctions.getGcpProjects(GetGcpProjectsArgs.builder()
                .connectorId("my_gcp_secret_manager_connector")
                .build());
    
            // Example: List GCP projects with org and project scope
            final var exampleScoped = PlatformFunctions.getGcpProjects(GetGcpProjectsArgs.builder()
                .connectorId("my_gcp_connector")
                .orgId("my_org")
                .projectId("my_project")
                .build());
    
            ctx.export("gcpProjects", example.projects());
        }
    }
    
    variables:
      # Example: List GCP projects using a GCP cloud connector
      example:
        fn::invoke:
          function: harness:platform:getGcpProjects
          arguments:
            connectorId: my_gcp_connector
      # Example: List GCP projects using a GCP secret manager connector
      exampleSecretManager:
        fn::invoke:
          function: harness:platform:getGcpProjects
          arguments:
            connectorId: my_gcp_secret_manager_connector
      # Example: List GCP projects with org and project scope
      exampleScoped:
        fn::invoke:
          function: harness:platform:getGcpProjects
          arguments:
            connectorId: my_gcp_connector
            orgId: my_org
            projectId: my_project
    outputs:
      # Output the projects
      gcpProjects: ${example.projects}
    

    Using getGcpProjects

    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 getGcpProjects(args: GetGcpProjectsArgs, opts?: InvokeOptions): Promise<GetGcpProjectsResult>
    function getGcpProjectsOutput(args: GetGcpProjectsOutputArgs, opts?: InvokeOptions): Output<GetGcpProjectsResult>
    def get_gcp_projects(connector_id: Optional[str] = None,
                         org_id: Optional[str] = None,
                         project_id: Optional[str] = None,
                         opts: Optional[InvokeOptions] = None) -> GetGcpProjectsResult
    def get_gcp_projects_output(connector_id: Optional[pulumi.Input[str]] = None,
                         org_id: Optional[pulumi.Input[str]] = None,
                         project_id: Optional[pulumi.Input[str]] = None,
                         opts: Optional[InvokeOptions] = None) -> Output[GetGcpProjectsResult]
    func GetGcpProjects(ctx *Context, args *GetGcpProjectsArgs, opts ...InvokeOption) (*GetGcpProjectsResult, error)
    func GetGcpProjectsOutput(ctx *Context, args *GetGcpProjectsOutputArgs, opts ...InvokeOption) GetGcpProjectsResultOutput

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

    public static class GetGcpProjects 
    {
        public static Task<GetGcpProjectsResult> InvokeAsync(GetGcpProjectsArgs args, InvokeOptions? opts = null)
        public static Output<GetGcpProjectsResult> Invoke(GetGcpProjectsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetGcpProjectsResult> getGcpProjects(GetGcpProjectsArgs args, InvokeOptions options)
    public static Output<GetGcpProjectsResult> getGcpProjects(GetGcpProjectsArgs args, InvokeOptions options)
    
    fn::invoke:
      function: harness:platform/getGcpProjects:getGcpProjects
      arguments:
        # arguments dictionary

    The following arguments are supported:

    ConnectorId string
    Identifier of the GCP cloud connector or secret manager connector.
    OrgId string
    Unique identifier of the organization.
    ProjectId string
    Unique identifier of the project.
    ConnectorId string
    Identifier of the GCP cloud connector or secret manager connector.
    OrgId string
    Unique identifier of the organization.
    ProjectId string
    Unique identifier of the project.
    connectorId String
    Identifier of the GCP cloud connector or secret manager connector.
    orgId String
    Unique identifier of the organization.
    projectId String
    Unique identifier of the project.
    connectorId string
    Identifier of the GCP cloud connector or secret manager connector.
    orgId string
    Unique identifier of the organization.
    projectId string
    Unique identifier of the project.
    connector_id str
    Identifier of the GCP cloud connector or secret manager connector.
    org_id str
    Unique identifier of the organization.
    project_id str
    Unique identifier of the project.
    connectorId String
    Identifier of the GCP cloud connector or secret manager connector.
    orgId String
    Unique identifier of the organization.
    projectId String
    Unique identifier of the project.

    getGcpProjects Result

    The following output properties are available:

    ConnectorId string
    Identifier of the GCP cloud connector or secret manager connector.
    Id string
    The provider-assigned unique ID for this managed resource.
    Projects List<GetGcpProjectsProject>
    OrgId string
    Unique identifier of the organization.
    ProjectId string
    Unique identifier of the project.
    ConnectorId string
    Identifier of the GCP cloud connector or secret manager connector.
    Id string
    The provider-assigned unique ID for this managed resource.
    Projects []GetGcpProjectsProject
    OrgId string
    Unique identifier of the organization.
    ProjectId string
    Unique identifier of the project.
    connectorId String
    Identifier of the GCP cloud connector or secret manager connector.
    id String
    The provider-assigned unique ID for this managed resource.
    projects List<GetGcpProjectsProject>
    orgId String
    Unique identifier of the organization.
    projectId String
    Unique identifier of the project.
    connectorId string
    Identifier of the GCP cloud connector or secret manager connector.
    id string
    The provider-assigned unique ID for this managed resource.
    projects GetGcpProjectsProject[]
    orgId string
    Unique identifier of the organization.
    projectId string
    Unique identifier of the project.
    connector_id str
    Identifier of the GCP cloud connector or secret manager connector.
    id str
    The provider-assigned unique ID for this managed resource.
    projects Sequence[GetGcpProjectsProject]
    org_id str
    Unique identifier of the organization.
    project_id str
    Unique identifier of the project.
    connectorId String
    Identifier of the GCP cloud connector or secret manager connector.
    id String
    The provider-assigned unique ID for this managed resource.
    projects List<Property Map>
    orgId String
    Unique identifier of the organization.
    projectId String
    Unique identifier of the project.

    Supporting Types

    GetGcpProjectsProject

    Id string
    Name string
    Id string
    Name string
    id String
    name String
    id string
    name string
    id str
    name str
    id String
    name String

    Package Details

    Repository
    harness pulumi/pulumi-harness
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the harness Terraform Provider.
    harness logo
    Harness v0.11.0 published on Saturday, Jan 24, 2026 by Pulumi
      Meet Neo: Your AI Platform Teammate