-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add route_rules to UrlMap for Traffic Director (#2748)
Merged PR #2748.
- Loading branch information
1 parent
937646c
commit 1d93b45
Showing
10 changed files
with
1,362 additions
and
55 deletions.
There are no files selected for viewing
Submodule ansible
updated
from 95adac to e3afbd
Submodule inspec
updated
37 files
Submodule terraform
updated
from 190859 to a380e6
Submodule terraform-beta
updated
from 6496dd to d2b00d
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
templates/terraform/examples/url_map_traffic_director_route.tf.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
resource "google_compute_url_map" "<%= ctx[:primary_resource_id] %>" { | ||
name = "<%= ctx[:vars]['url_map_name'] %>" | ||
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}" | ||
|
||
route_rules { | ||
priority = 1 | ||
header_action { | ||
request_headers_to_remove = ["RemoveMe2"] | ||
request_headers_to_add { | ||
header_name = "AddSomethingElse" | ||
header_value = "MyOtherValue" | ||
replace = true | ||
} | ||
response_headers_to_remove = ["RemoveMe3"] | ||
response_headers_to_add { | ||
header_name = "AddMe" | ||
header_value = "MyValue" | ||
replace = false | ||
} | ||
} | ||
match_rules { | ||
full_path_match = "a full path" | ||
header_matches { | ||
header_name = "someheader" | ||
exact_match = "match this exactly" | ||
invert_match = true | ||
} | ||
ignore_case = true | ||
metadata_filters { | ||
filter_match_criteria = "MATCH_ANY" | ||
filter_labels { | ||
name = "PLANET" | ||
value = "MARS" | ||
} | ||
} | ||
query_parameter_matches { | ||
name = "a query parameter" | ||
present_match = true | ||
} | ||
} | ||
url_redirect { | ||
host_redirect = "A host" | ||
https_redirect = false | ||
path_redirect = "some/path" | ||
redirect_response_code = "TEMPORARY_REDIRECT" | ||
strip_query = true | ||
} | ||
} | ||
} | ||
|
||
test { | ||
service = "${google_compute_backend_service.home.self_link}" | ||
host = "hi.com" | ||
path = "/home" | ||
} | ||
} | ||
|
||
resource "google_compute_backend_service" "home" { | ||
name = "<%= ctx[:vars]['home_backend_service_name'] %>" | ||
port_name = "http" | ||
protocol = "HTTP" | ||
timeout_sec = 10 | ||
|
||
health_checks = ["${google_compute_health_check.default.self_link}"] | ||
load_balancing_scheme = "INTERNAL_SELF_MANAGED" | ||
} | ||
|
||
resource "google_compute_health_check" "default" { | ||
name = "<%= ctx[:vars]['health_check_name'] %>" | ||
http_health_check { | ||
port = 80 | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
templates/terraform/examples/url_map_traffic_director_route_partial.tf.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
resource "google_compute_url_map" "<%= ctx[:primary_resource_id] %>" { | ||
name = "<%= ctx[:vars]['url_map_name'] %>" | ||
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}" | ||
|
||
route_rules { | ||
priority = 1 | ||
match_rules { | ||
prefix_match = "/someprefix" | ||
header_matches { | ||
header_name = "someheader" | ||
exact_match = "match this exactly" | ||
invert_match = true | ||
} | ||
} | ||
url_redirect { | ||
path_redirect = "some/path" | ||
redirect_response_code = "TEMPORARY_REDIRECT" | ||
} | ||
} | ||
} | ||
|
||
test { | ||
service = "${google_compute_backend_service.home.self_link}" | ||
host = "hi.com" | ||
path = "/home" | ||
} | ||
} | ||
|
||
resource "google_compute_backend_service" "home" { | ||
name = "<%= ctx[:vars]['home_backend_service_name'] %>" | ||
port_name = "http" | ||
protocol = "HTTP" | ||
timeout_sec = 10 | ||
|
||
health_checks = ["${google_compute_health_check.default.self_link}"] | ||
load_balancing_scheme = "INTERNAL_SELF_MANAGED" | ||
} | ||
|
||
resource "google_compute_health_check" "default" { | ||
name = "<%= ctx[:vars]['health_check_name'] %>" | ||
http_health_check { | ||
port = 80 | ||
} | ||
} |
Oops, something went wrong.