1. Packages
  2. Packages
  3. Google Cloud (GCP) Classic
  4. API Docs
  5. projectFromId
Viewing docs for Google Cloud v9.32.1
published on Wednesday, Jul 29, 2026 by Pulumi
gcp logo
Viewing docs for Google Cloud v9.32.1
published on Wednesday, Jul 29, 2026 by Pulumi

    Returns the project within a provided resource’s id, resource URI, self link, or full resource name.

    For more information about using provider-defined functions with Terraform see the official documentation.

    Example Usage

    Signature

    project_from_id(id string) string
    

    Using projectFromId

    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 projectFromId(args: ProjectFromIdArgs, opts?: InvokeOptions): Promise<ProjectFromIdResult>
    function projectFromIdOutput(args: ProjectFromIdOutputArgs, opts?: InvokeOptions): Output<ProjectFromIdResult>
    def project_from_id(id: Optional[str] = None,
                        opts: Optional[InvokeOptions] = None) -> ProjectFromIdResult
    def project_from_id_output(id: pulumi.Input[Optional[str]] = None,
                        opts: Optional[InvokeOptions] = None) -> Output[ProjectFromIdResult]
    func ProjectFromId(ctx *Context, args *ProjectFromIdArgs, opts ...InvokeOption) (*ProjectFromIdResult, error)
    func ProjectFromIdOutput(ctx *Context, args *ProjectFromIdOutputArgs, opts ...InvokeOption) ProjectFromIdResultOutput

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

    public static class ProjectFromId 
    {
        public static Task<ProjectFromIdResult> InvokeAsync(ProjectFromIdArgs args, InvokeOptions? opts = null)
        public static Output<ProjectFromIdResult> Invoke(ProjectFromIdInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<ProjectFromIdResult> projectFromId(ProjectFromIdArgs args, InvokeOptions options)
    public static Output<ProjectFromIdResult> projectFromId(ProjectFromIdArgs args, InvokeOptions options)
    
    fn::invoke:
      function: gcp:index/projectFromId:projectFromId
      arguments:
        # arguments dictionary
    data "gcp_project_from_id" "name" {
        # arguments
    }

    The following arguments are supported:

    Id string
    A string of a resource's id, resource URI, self link, or full resource name. For example, "projects/my-project/zones/us-central1-c/instances/my-instance", "https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-c/instances/my-instance" and "//gkehub.googleapis.com/projects/my-project/locations/us-central1/memberships/my-membership" are valid values
    Id string
    A string of a resource's id, resource URI, self link, or full resource name. For example, "projects/my-project/zones/us-central1-c/instances/my-instance", "https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-c/instances/my-instance" and "//gkehub.googleapis.com/projects/my-project/locations/us-central1/memberships/my-membership" are valid values
    id string
    A string of a resource's id, resource URI, self link, or full resource name. For example, "projects/my-project/zones/us-central1-c/instances/my-instance", "https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-c/instances/my-instance" and "//gkehub.googleapis.com/projects/my-project/locations/us-central1/memberships/my-membership" are valid values
    id String
    A string of a resource's id, resource URI, self link, or full resource name. For example, "projects/my-project/zones/us-central1-c/instances/my-instance", "https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-c/instances/my-instance" and "//gkehub.googleapis.com/projects/my-project/locations/us-central1/memberships/my-membership" are valid values
    id string
    A string of a resource's id, resource URI, self link, or full resource name. For example, "projects/my-project/zones/us-central1-c/instances/my-instance", "https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-c/instances/my-instance" and "//gkehub.googleapis.com/projects/my-project/locations/us-central1/memberships/my-membership" are valid values
    id str
    A string of a resource's id, resource URI, self link, or full resource name. For example, "projects/my-project/zones/us-central1-c/instances/my-instance", "https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-c/instances/my-instance" and "//gkehub.googleapis.com/projects/my-project/locations/us-central1/memberships/my-membership" are valid values
    id String
    A string of a resource's id, resource URI, self link, or full resource name. For example, "projects/my-project/zones/us-central1-c/instances/my-instance", "https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-c/instances/my-instance" and "//gkehub.googleapis.com/projects/my-project/locations/us-central1/memberships/my-membership" are valid values

    projectFromId Result

    The following output properties are available:

    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
    Viewing docs for Google Cloud v9.32.1
    published on Wednesday, Jul 29, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial