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

    region_from_id(id string) string
    

    Using regionFromId

    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 regionFromId(args: RegionFromIdArgs, opts?: InvokeOptions): Promise<RegionFromIdResult>
    function regionFromIdOutput(args: RegionFromIdOutputArgs, opts?: InvokeOptions): Output<RegionFromIdResult>
    def region_from_id(id: Optional[str] = None,
                       opts: Optional[InvokeOptions] = None) -> RegionFromIdResult
    def region_from_id_output(id: pulumi.Input[Optional[str]] = None,
                       opts: Optional[InvokeOptions] = None) -> Output[RegionFromIdResult]
    func RegionFromId(ctx *Context, args *RegionFromIdArgs, opts ...InvokeOption) (*RegionFromIdResult, error)
    func RegionFromIdOutput(ctx *Context, args *RegionFromIdOutputArgs, opts ...InvokeOption) RegionFromIdResultOutput

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

    public static class RegionFromId 
    {
        public static Task<RegionFromIdResult> InvokeAsync(RegionFromIdArgs args, InvokeOptions? opts = null)
        public static Output<RegionFromIdResult> Invoke(RegionFromIdInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<RegionFromIdResult> regionFromId(RegionFromIdArgs args, InvokeOptions options)
    public static Output<RegionFromIdResult> regionFromId(RegionFromIdArgs args, InvokeOptions options)
    
    fn::invoke:
      function: gcp:index/regionFromId:regionFromId
      arguments:
        # arguments dictionary
    data "gcp_region_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/regions/us-central1/subnetworks/my-subnetwork" and "https://www.googleapis.com/compute/v1/projects/my-project/regions/us-central1/subnetworks/my-subnetwork" are valid values containing regions
    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/regions/us-central1/subnetworks/my-subnetwork" and "https://www.googleapis.com/compute/v1/projects/my-project/regions/us-central1/subnetworks/my-subnetwork" are valid values containing regions
    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/regions/us-central1/subnetworks/my-subnetwork" and "https://www.googleapis.com/compute/v1/projects/my-project/regions/us-central1/subnetworks/my-subnetwork" are valid values containing regions
    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/regions/us-central1/subnetworks/my-subnetwork" and "https://www.googleapis.com/compute/v1/projects/my-project/regions/us-central1/subnetworks/my-subnetwork" are valid values containing regions
    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/regions/us-central1/subnetworks/my-subnetwork" and "https://www.googleapis.com/compute/v1/projects/my-project/regions/us-central1/subnetworks/my-subnetwork" are valid values containing regions
    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/regions/us-central1/subnetworks/my-subnetwork" and "https://www.googleapis.com/compute/v1/projects/my-project/regions/us-central1/subnetworks/my-subnetwork" are valid values containing regions
    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/regions/us-central1/subnetworks/my-subnetwork" and "https://www.googleapis.com/compute/v1/projects/my-project/regions/us-central1/subnetworks/my-subnetwork" are valid values containing regions

    regionFromId 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