github.com/nathanielks/terraform@v0.6.1-0.20170509030759-13e1a62319dc/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-compute-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 ```hcl 20 resource "google_compute_url_map" "foobar" { 21 name = "urlmap" 22 description = "a description" 23 24 default_service = "${google_compute_backend_service.home.self_link}" 25 26 host_rule { 27 hosts = ["mysite.com"] 28 path_matcher = "allpaths" 29 } 30 31 path_matcher { 32 name = "allpaths" 33 default_service = "${google_compute_backend_service.home.self_link}" 34 35 path_rule { 36 paths = ["/home"] 37 service = "${google_compute_backend_service.home.self_link}" 38 } 39 40 path_rule { 41 paths = ["/login"] 42 service = "${google_compute_backend_service.login.self_link}" 43 } 44 45 path_rule { 46 paths = ["/static"] 47 service = "${google_compute_backend_bucket.static.self_link}" 48 } 49 } 50 51 test { 52 service = "${google_compute_backend_service.home.self_link}" 53 host = "hi.com" 54 path = "/home" 55 } 56 } 57 58 resource "google_compute_backend_service" "login" { 59 name = "login-backend" 60 port_name = "http" 61 protocol = "HTTP" 62 timeout_sec = 10 63 64 health_checks = ["${google_compute_http_health_check.default.self_link}"] 65 } 66 67 resource "google_compute_backend_service" "home" { 68 name = "home-backend" 69 port_name = "http" 70 protocol = "HTTP" 71 timeout_sec = 10 72 73 health_checks = ["${google_compute_http_health_check.default.self_link}"] 74 } 75 76 resource "google_compute_http_health_check" "default" { 77 name = "test" 78 request_path = "/" 79 check_interval_sec = 1 80 timeout_sec = 1 81 } 82 83 resource "google_compute_backend_bucket" "static" { 84 name = "static-asset-backend-bucket" 85 bucket_name = "${google_storage_bucket.static.name}" 86 enable_cdn = true 87 } 88 89 resource "google_storage_bucket" "static" { 90 name = "static-asset-bucket" 91 location = "US" 92 } 93 ``` 94 95 ## Argument Reference 96 97 The following arguments are supported: 98 99 * `default_service` - (Required) The URL of the backend service or backend bucket to use when none 100 of the given rules match. See the documentation for formatting the service/bucket 101 URL 102 [here](https://cloud.google.com/compute/docs/reference/latest/urlMaps#defaultService) 103 104 * `name` - (Required) A unique name for the resource, required by GCE. 105 Changing this forces a new resource to be created. 106 107 - - - 108 109 * `description` - (Optional) A brief description of this resource. 110 111 * `host_rule` - (Optional) A list of host rules. See below for configuration 112 options. 113 114 * `path_matcher` - (Optional) A list of paths to match. See below for 115 configuration options. 116 117 * `project` - (Optional) The project in which the resource belongs. If it 118 is not provided, the provider project is used. 119 120 * `test` - (Optional) The test to perform. See below for configuration options. 121 122 The `host_rule` block supports: (This block can be defined multiple times). 123 124 * `hosts` (Required) - A list of hosts to match against. See the documentation 125 for formatting each host 126 [here](https://cloud.google.com/compute/docs/reference/latest/urlMaps#hostRules.hosts) 127 128 * `description` - (Optional) An optional description of the host rule. 129 130 * `path_matcher` - (Required) The name of the `path_matcher` (defined below) 131 to apply this host rule to. 132 133 The `path_matcher` block supports: (This block can be defined multiple times) 134 135 * `default_service` - (Required) The URL for the backend service or backend bucket to use if none 136 of the given paths match. See the documentation for formatting the service/bucket 137 URL [here](https://cloud.google.com/compute/docs/reference/latest/urlMaps#pathMatcher.defaultService) 138 139 * `name` - (Required) The name of the `path_matcher` resource. Used by the 140 `host_rule` block above. 141 142 * `description` - (Optional) An optional description of the host rule. 143 144 The `path_matcher.path_rule` sub-block supports: (This block can be defined 145 multiple times) 146 147 * `paths` - (Required) The list of paths to match against. See the 148 documentation for formatting these [here](https://cloud.google.com/compute/docs/reference/latest/urlMaps#pathMatchers.pathRules.paths) 149 150 * `service` - (Required) The URL for the backend service or backend bucket to use if any 151 of the given paths match. See the documentation for formatting the service/bucket 152 URL [here](https://cloud.google.com/compute/docs/reference/latest/urlMaps#pathMatcher.defaultService) 153 154 The optional `test` block supports: (This block can be defined multiple times) 155 156 * `service` - (Required) The backend service or backend bucket that should be matched by this test. 157 158 * `host` - (Required) The host component of the URL being tested. 159 160 * `path` - (Required) The path component of the URL being tested. 161 162 * `description` - (Optional) An optional description of this test. 163 164 ## Attributes Reference 165 166 In addition to the arguments listed above, the following computed attributes are 167 exported: 168 169 * `fingerprint` - The unique fingerprint for this resource. 170 171 * `id` - The GCE assigned ID of the resource. 172 173 * `self_link` - The URI of the created resource.