FEATURES PRICING ABOUT DOCS LOGIN

google_compute_url_map

Manages a URL Map resource within GCE. For more information see the official documentation and API.

Example Usage

resource "google_compute_url_map" "foobar" {
  name        = "urlmap"
  description = "a description"

  default_service = "${google_compute_backend_service.home.self_link}"

  host_rule {
    hosts        = ["mysite.com"]
    path_matcher = "allpaths"
  }

  path_matcher {
    name            = "allpaths"
    default_service = "${google_compute_backend_service.home.self_link}"

    path_rule {
      paths   = ["/home"]
      service = "${google_compute_backend_service.home.self_link}"
    }

    path_rule {
      paths   = ["/login"]
      service = "${google_compute_backend_service.login.self_link}"
    }
  }

  test {
    service = "${google_compute_backend_service.home.self_link}"
    host    = "hi.com"
    path    = "/home"
  }
}

resource "google_compute_backend_service" "login" {
  name        = "login-backend"
  port_name   = "http"
  protocol    = "HTTP"
  timeout_sec = 10
  region      = "us-central1"

  health_checks = ["${google_compute_http_health_check.default.self_link}"]
}

resource "google_compute_backend_service" "home" {
  name        = "home-backend"
  port_name   = "http"
  protocol    = "HTTP"
  timeout_sec = 10
  region      = "us-central1"

  health_checks = ["${google_compute_http_health_check.default.self_link}"]
}

resource "google_compute_http_health_check" "default" {
  name               = "test"
  request_path       = "/"
  check_interval_sec = 1
  timeout_sec        = 1
}

Argument Reference

The following arguments are supported:


The host_rule block supports: (This block can be defined multiple times).

The path_matcher block supports: (This block can be defined multiple times)

The path_matcher.path_rule sub-block supports: (This block can be defined multiple times)

The optional test block supports: (This block can be defined multiple times)

Attributes Reference

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


See the source of this document at Terraform.io

REQUEST A DEMO