github.com/jmbataller/terraform@v0.6.8-0.20151125192640-b7a12e3a580c/website/source/docs/providers/google/r/compute_url_map.html.markdown (about) 1 --- 2 layout: "google" 3 page_title: "Google: google_compute_url_map" 4 sidebar_current: "docs-google-resource-url-map" 5 description: |- 6 Manages a URL Map resource in GCE. 7 --- 8 9 # google\_compute\_url\_map 10 11 Manages a URL Map resource within GCE. For more information see 12 [the official documentation](https://cloud.google.com/compute/docs/load-balancing/http/url-map) 13 and 14 [API](https://cloud.google.com/compute/docs/reference/latest/urlMaps). 15 16 17 ## Example Usage 18 19 ``` 20 resource "google_compute_url_map" "foobar" { 21 name = "urlmap" 22 description = "a description" 23 default_service = "${google_compute_backend_service.home.self_link}" 24 25 host_rule { 26 hosts = ["mysite.com"] 27 path_matcher = "allpaths" 28 } 29 30 path_matcher { 31 default_service = "${google_compute_backend_service.home.self_link}" 32 name = "allpaths" 33 path_rule { 34 paths = ["/home"] 35 service = "${google_compute_backend_service.home.self_link}" 36 } 37 38 path_rule { 39 paths = ["/login"] 40 service = "${google_compute_backend_service.login.self_link}" 41 } 42 } 43 44 test { 45 service = "${google_compute_backend_service.home.self_link}" 46 host = "hi.com" 47 path = "/home" 48 } 49 } 50 51 resource "google_compute_backend_service" "login" { 52 name = "login-backend" 53 port_name = "http" 54 protocol = "HTTP" 55 timeout_sec = 10 56 region = "us-central1" 57 58 health_checks = ["${google_compute_http_health_check.default.self_link}"] 59 } 60 61 resource "google_compute_backend_service" "home" { 62 name = "home-backend" 63 port_name = "http" 64 protocol = "HTTP" 65 timeout_sec = 10 66 region = "us-central1" 67 68 health_checks = ["${google_compute_http_health_check.default.self_link}"] 69 } 70 71 resource "google_compute_http_health_check" "default" { 72 name = "test" 73 request_path = "/" 74 check_interval_sec = 1 75 timeout_sec = 1 76 } 77 ``` 78 79 ## Argument Reference 80 81 The following arguments are supported: 82 83 * `name` - (Required) A unique name for the resource, required by GCE. 84 Changing this forces a new resource to be created. 85 86 * `description` - (Optional) A brief description of this resource. 87 88 * `default_service` - (Required) The URL of the backend service to use when none of the 89 given rules match. See the documentation for formatting the service URL 90 [here](https://cloud.google.com/compute/docs/reference/latest/urlMaps#defaultService) 91 92 The `host_rule` block supports: (Note that this block can be defined an arbitrary 93 number of times.) 94 95 * `hosts` (Required) - A list of hosts to match against. See the documention 96 for formatting each host [here](https://cloud.google.com/compute/docs/reference/latest/urlMaps#hostRules.hosts) 97 98 * `description` - (Optional) An optional description of the host rule. 99 100 * `path_matcher` - (Required) The name of the `path_matcher` (defined below) 101 to apply this host rule to. 102 103 The `path_matcher` block supports: (Note that this block can be defined an arbitrary 104 number of times.) 105 106 * `default_service` - (Required) The URL for the backend service to use if none 107 of the given paths match. See the documentation for formatting the service URL 108 [here](https://cloud.google.com/compute/docs/reference/latest/urlMaps#pathMatcher.defaultService) 109 110 * `name` - (Required) The name of the `path_matcher` resource. Used by the `host_rule` 111 block above. 112 113 * `description` - (Optional) An optional description of the host rule. 114 115 The `path_matcher.path_rule` sub-block supports: (Note that this block can be defined an arbitrary 116 number of times.) 117 118 * `paths` - (Required) The list of paths to match against. See the 119 documentation for formatting these [here](https://cloud.google.com/compute/docs/reference/latest/urlMaps#pathMatchers.pathRules.paths) 120 121 * `default_service` - (Required) The URL for the backend service to use if any 122 of the given paths match. See the documentation for formatting the service URL 123 [here](https://cloud.google.com/compute/docs/reference/latest/urlMaps#pathMatcher.defaultService) 124 125 The optional `test` block supports: (Note that this block can be defined an arbitary 126 number of times.) 127 128 * `service` - (Required) The service that should be matched by this test. 129 130 * `host` - (Required) The host component of the URL being tested. 131 132 * `path` - (Required) The path component of the URL being tested. 133 134 * `description` - (Optional) An optional description of this test. 135 136 ## Attributes Reference 137 138 The following attributes are exported: 139 140 * `id` - The GCE assigned ID of the resource. 141 * `self_link` - A GCE assigned link to the resource.