google_app_engine_application_url_dispatch_rules

Rules to match an HTTP request and dispatch that request to a service.

To get more information about ApplicationUrlDispatchRules, see:

Open in Cloud Shell

Example Usage - App Engine Application Url Dispatch Rules Basic

resource "google_app_engine_application_url_dispatch_rules" "web_service" {
  dispatch_rules {
    domain  = "*"
    path    = "/*"
    service = "default"
  }

  dispatch_rules {
    domain  = "*"
    path    = "/admin/*"
    service = google_app_engine_standard_app_version.admin_v3.service
  }
}

resource "google_app_engine_standard_app_version" "admin_v3" {
  version_id = "v3"
  service    = "admin"
  runtime    = "nodejs20"

  entrypoint {
    shell = "node ./app.js"
  }

  deployment {
    zip {
      source_url = "https://storage.googleapis.com/${google_storage_bucket.bucket.name}/${google_storage_bucket_object.object.name}"
    }
  }

  env_variables = {
    port = "8080"
  }

  delete_service_on_destroy = true
}

resource "google_storage_bucket" "bucket" {
  name     = "appengine-test-bucket"
  location = "US"
}

resource "google_storage_bucket_object" "object" {
  name   = "hello-world.zip"
  bucket = google_storage_bucket.bucket.name
  source = "./test-fixtures/hello-world.zip"
}

Argument Reference

The following arguments are supported:

The dispatch_rules block supports:


Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

Timeouts

This resource provides the following Timeouts configuration options:

Import

ApplicationUrlDispatchRules can be imported using any of these accepted formats:

In Terraform v1.5.0 and later, use an import block to import ApplicationUrlDispatchRules using one of the formats above. For example:

import {
  id = "{{project}}"
  to = google_app_engine_application_url_dispatch_rules.default
}

When using the terraform import command, ApplicationUrlDispatchRules can be imported using one of the formats above. For example:

$ terraform import google_app_engine_application_url_dispatch_rules.default {{project}}

User Project Overrides

This resource supports User Project Overrides.