1. Packages
  2. Packages
  3. Google Cloud (GCP) Classic
  4. API Docs
  5. locationFromId
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 location 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

    location_from_id(id string) string
    

    Using locationFromId

    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 locationFromId(args: LocationFromIdArgs, opts?: InvokeOptions): Promise<LocationFromIdResult>
    function locationFromIdOutput(args: LocationFromIdOutputArgs, opts?: InvokeOptions): Output<LocationFromIdResult>
    def location_from_id(id: Optional[str] = None,
                         opts: Optional[InvokeOptions] = None) -> LocationFromIdResult
    def location_from_id_output(id: pulumi.Input[Optional[str]] = None,
                         opts: Optional[InvokeOptions] = None) -> Output[LocationFromIdResult]
    func LocationFromId(ctx *Context, args *LocationFromIdArgs, opts ...InvokeOption) (*LocationFromIdResult, error)
    func LocationFromIdOutput(ctx *Context, args *LocationFromIdOutputArgs, opts ...InvokeOption) LocationFromIdResultOutput

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

    public static class LocationFromId 
    {
        public static Task<LocationFromIdResult> InvokeAsync(LocationFromIdArgs args, InvokeOptions? opts = null)
        public static Output<LocationFromIdResult> Invoke(LocationFromIdInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<LocationFromIdResult> locationFromId(LocationFromIdArgs args, InvokeOptions options)
    public static Output<LocationFromIdResult> locationFromId(LocationFromIdArgs args, InvokeOptions options)
    
    fn::invoke:
      function: gcp:index/locationFromId:locationFromId
      arguments:
        # arguments dictionary
    data "gcp_location_from_id" "name" {
        # arguments
    }

    The following arguments are supported:

    Id string
    A string of a resource's id, a resource's self link, or an OP style resource name. For example, "projects/my-project/locations/us-central1/services/my-service" and "https://run.googleapis.com/v2/projects/my-project/locations/us-central1/services/my-service" are valid values containing locations
    Id string
    A string of a resource's id, a resource's self link, or an OP style resource name. For example, "projects/my-project/locations/us-central1/services/my-service" and "https://run.googleapis.com/v2/projects/my-project/locations/us-central1/services/my-service" are valid values containing locations
    id string
    A string of a resource's id, a resource's self link, or an OP style resource name. For example, "projects/my-project/locations/us-central1/services/my-service" and "https://run.googleapis.com/v2/projects/my-project/locations/us-central1/services/my-service" are valid values containing locations
    id String
    A string of a resource's id, a resource's self link, or an OP style resource name. For example, "projects/my-project/locations/us-central1/services/my-service" and "https://run.googleapis.com/v2/projects/my-project/locations/us-central1/services/my-service" are valid values containing locations
    id string
    A string of a resource's id, a resource's self link, or an OP style resource name. For example, "projects/my-project/locations/us-central1/services/my-service" and "https://run.googleapis.com/v2/projects/my-project/locations/us-central1/services/my-service" are valid values containing locations
    id str
    A string of a resource's id, a resource's self link, or an OP style resource name. For example, "projects/my-project/locations/us-central1/services/my-service" and "https://run.googleapis.com/v2/projects/my-project/locations/us-central1/services/my-service" are valid values containing locations
    id String
    A string of a resource's id, a resource's self link, or an OP style resource name. For example, "projects/my-project/locations/us-central1/services/my-service" and "https://run.googleapis.com/v2/projects/my-project/locations/us-central1/services/my-service" are valid values containing locations

    locationFromId 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