Google Compute Engine URL Map

This page shows how to write Terraform for Compute Engine URL Map and write them securely.

code-icon

Fix issues in your cloud & app configurations

Test for misconfigurations of this resource in your cloud.

get-started-button

Terraform Example (google_compute_url_map)

UrlMaps are used to route requests to a backend service based on rules that you define for the host and path of an incoming URL. To get more information about UrlMap, see:

Parameters

  • creation_timestamp requiredcomputed - string
    • Creation timestamp in RFC3339 text format.

  • default_service optional - string
    • The backend service or backend bucket to use when none of the given rules match.

  • description optional - string
    • An optional description of this resource. Provide this property when you create the resource.

  • fingerprint requiredcomputed - string
    • Fingerprint of this resource. A hash of the contents stored in this object. This field is used in optimistic locking.

  • id optionalcomputed - string
  • map_id requiredcomputed - number
    • The unique identifier for the resource.

  • name required - string
    • Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression 'a-z?' which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.

  • project optionalcomputed - string
  • self_link requiredcomputed - string

Example Usage (from GitHub)

github-iconMatthewCYLau/react-serverless-gcp-terraform
resource "google_compute_url_map" "web_https" {
  provider        = google
  name            = "web-url-map-https"
  default_service = google_compute_backend_bucket.static_site.self_link
}

github-iconkennedycmr/terraform-google-cloudrun-public-byo-domainname
resource "google_compute_url_map" "http" {
  name    = local.HTTP_URLMAP_NAME
  project = data.google_project.primary.number
  default_url_redirect {
    https_redirect         = true
    redirect_response_code = "MOVED_PERMANENTLY_DEFAULT"
github-iconrdeknijf/github-actions-upgrader
resource "google_compute_url_map" "main" {
  name            = "gaup"
  default_service = google_compute_backend_bucket.main.self_link
}

resource "google_compute_managed_ssl_certificate" "main" {
github-iconpeytoncasper/remarkable-sidekick
resource "google_compute_url_map" "marketing_site_https" {
  name        = "marketing-site-https-url-map"
  description = "URL Map for the Remarkable Sidekick Marketing Page"

  default_service = google_compute_backend_bucket.marketing_site.id

Frequently asked questions

What is Google Compute Engine URL Map?

Google Compute Engine URL Map is a resource for Compute Engine of Google Cloud Platform. Settings can be wrote in Terraform.

Where can I find the example code for the Google Compute Engine URL Map?

For Terraform, the MatthewCYLau/react-serverless-gcp-terraform, kennedycmr/terraform-google-cloudrun-public-byo-domainname and rdeknijf/github-actions-upgrader source code examples are useful. See the Terraform Example section for further details.