From 7ecc5157041ecd25deb2b201ec1b82dc17a7713a Mon Sep 17 00:00:00 2001 From: Christoph Tavan Date: Thu, 27 Apr 2017 09:21:33 +0200 Subject: [PATCH] provider/google: Document backend buckets for compute_url_map The current google_compute_url_map resource already supports backend buckets out of the box: Just pass the self_link of the backend buckets as you would pass the self_link of a backend service. This adds some example code as well. --- .../google/r/compute_url_map.html.markdown | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/website/source/docs/providers/google/r/compute_url_map.html.markdown b/website/source/docs/providers/google/r/compute_url_map.html.markdown index 4d089e1c6..86d893c2e 100644 --- a/website/source/docs/providers/google/r/compute_url_map.html.markdown +++ b/website/source/docs/providers/google/r/compute_url_map.html.markdown @@ -41,6 +41,11 @@ resource "google_compute_url_map" "foobar" { paths = ["/login"] service = "${google_compute_backend_service.login.self_link}" } + + path_rule { + paths = ["/static"] + service = "${google_compute_backend_bucket.static.self_link}" + } } test { @@ -74,14 +79,25 @@ resource "google_compute_http_health_check" "default" { check_interval_sec = 1 timeout_sec = 1 } + +resource "google_compute_backend_bucket" "static" { + name = "static-asset-backend-bucket" + bucket_name = "${google_storage_bucket.static.name}" + enable_cdn = true +} + +resource "google_storage_bucket" "static" { + name = "static-asset-bucket" + location = "US" +} ``` ## Argument Reference The following arguments are supported: -* `default_service` - (Required) The URL of the backend service to use when none - of the given rules match. See the documentation for formatting the service +* `default_service` - (Required) The URL of the backend service or backend bucket to use when none + of the given rules match. See the documentation for formatting the service/bucket URL [here](https://cloud.google.com/compute/docs/reference/latest/urlMaps#defaultService) @@ -116,8 +132,8 @@ The `host_rule` block supports: (This block can be defined multiple times). The `path_matcher` block supports: (This block can be defined multiple times) -* `default_service` - (Required) The URL for the backend service to use if none - of the given paths match. See the documentation for formatting the service +* `default_service` - (Required) The URL for the backend service or backend bucket to use if none + of the given paths match. See the documentation for formatting the service/bucket URL [here](https://cloud.google.com/compute/docs/reference/latest/urlMaps#pathMatcher.defaultService) * `name` - (Required) The name of the `path_matcher` resource. Used by the @@ -131,13 +147,13 @@ multiple times) * `paths` - (Required) The list of paths to match against. See the documentation for formatting these [here](https://cloud.google.com/compute/docs/reference/latest/urlMaps#pathMatchers.pathRules.paths) -* `default_service` - (Required) The URL for the backend service to use if any - of the given paths match. See the documentation for formatting the service +* `default_service` - (Required) The URL for the backend service or backend bucket to use if any + of the given paths match. See the documentation for formatting the service/bucket URL [here](https://cloud.google.com/compute/docs/reference/latest/urlMaps#pathMatcher.defaultService) The optional `test` block supports: (This block can be defined multiple times) -* `service` - (Required) The service that should be matched by this test. +* `service` - (Required) The backend service or backend bucket that should be matched by this test. * `host` - (Required) The host component of the URL being tested.