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.
This commit is contained in:
Christoph Tavan 2017-04-27 09:21:33 +02:00
parent c853d91203
commit 7ecc515704
No known key found for this signature in database
GPG Key ID: D9B600C63A37FD28
1 changed files with 23 additions and 7 deletions

View File

@ -41,6 +41,11 @@ resource "google_compute_url_map" "foobar" {
paths = ["/login"] paths = ["/login"]
service = "${google_compute_backend_service.login.self_link}" service = "${google_compute_backend_service.login.self_link}"
} }
path_rule {
paths = ["/static"]
service = "${google_compute_backend_bucket.static.self_link}"
}
} }
test { test {
@ -74,14 +79,25 @@ resource "google_compute_http_health_check" "default" {
check_interval_sec = 1 check_interval_sec = 1
timeout_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 ## Argument Reference
The following arguments are supported: The following arguments are supported:
* `default_service` - (Required) The URL of the backend service to use when none * `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 of the given rules match. See the documentation for formatting the service/bucket
URL URL
[here](https://cloud.google.com/compute/docs/reference/latest/urlMaps#defaultService) [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) 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 * `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 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) 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 * `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 * `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) 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 * `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 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) 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) 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. * `host` - (Required) The host component of the URL being tested.