Skip to content

Commit

Permalink
Add route_rules to RegionUrlMap (#2807)
Browse files Browse the repository at this point in the history
Merged PR #2807.
  • Loading branch information
Ty Larrabee authored and modular-magician committed Dec 10, 2019
1 parent 2952d0b commit 732ba39
Show file tree
Hide file tree
Showing 10 changed files with 1,064 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build/ansible
2 changes: 1 addition & 1 deletion build/terraform
2 changes: 1 addition & 1 deletion build/terraform-beta
2 changes: 1 addition & 1 deletion build/terraform-mapper
690 changes: 690 additions & 0 deletions products/compute/api.yaml

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions products/compute/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1261,6 +1261,20 @@ overrides: !ruby/object:Overrides::ResourceOverrides
region_url_map_name: "regionurlmap"
home_region_backend_service_name: "home"
region_health_check_name: "health-check"
- !ruby/object:Provider::Terraform::Examples
name: "region_url_map_l7_ilb_route"
primary_resource_id: "regionurlmap"
vars:
region_url_map_name: "regionurlmap"
home_region_backend_service_name: "home"
region_health_check_name: "health-check"
- !ruby/object:Provider::Terraform::Examples
name: "region_url_map_l7_ilb_route_partial"
primary_resource_id: "regionurlmap"
vars:
region_url_map_name: "regionurlmap"
home_region_backend_service_name: "home"
region_health_check_name: "health-check"
properties:
region: !ruby/object:Overrides::Terraform::PropertyOverride
default_from_api: true
Expand Down
85 changes: 85 additions & 0 deletions templates/terraform/examples/region_url_map_l7_ilb_route.tf.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
resource "google_compute_region_url_map" "<%= ctx[:primary_resource_id] %>" {
provider = "google-beta"
name = "<%= ctx[:vars]['region_url_map_name'] %>"
description = "a description"
default_service = google_compute_region_backend_service.home.self_link

host_rule {
hosts = ["mysite.com"]
path_matcher = "allpaths"
}

path_matcher {
name = "allpaths"
default_service = google_compute_region_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_region_backend_service.home.self_link
host = "hi.com"
path = "/home"
}
}

resource "google_compute_region_backend_service" "home" {
provider = "google-beta"
name = "<%= ctx[:vars]['home_region_backend_service_name'] %>"
protocol = "HTTP"
timeout_sec = 10

health_checks = [google_compute_region_health_check.default.self_link]
load_balancing_scheme = "INTERNAL_MANAGED"
}

resource "google_compute_region_health_check" "default" {
provider = "google-beta"
name = "<%= ctx[:vars]['region_health_check_name'] %>"
http_health_check {
port = 80
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
resource "google_compute_region_url_map" "<%= ctx[:primary_resource_id] %>" {
provider = "google-beta"
name = "<%= ctx[:vars]['region_url_map_name'] %>"
description = "a description"
default_service = google_compute_region_backend_service.home.self_link

host_rule {
hosts = ["mysite.com"]
path_matcher = "allpaths"
}

path_matcher {
name = "allpaths"
default_service = google_compute_region_backend_service.home.self_link

route_rules {
priority = 1
service = google_compute_region_backend_service.home.self_link
header_action {
request_headers_to_remove = ["RemoveMe2"]
}
match_rules {
full_path_match = "a full path"
header_matches {
header_name = "someheader"
exact_match = "match this exactly"
invert_match = true
}
query_parameter_matches {
name = "a query parameter"
present_match = true
}
}
}
}

test {
service = google_compute_region_backend_service.home.self_link
host = "hi.com"
path = "/home"
}
}

resource "google_compute_region_backend_service" "home" {
provider = "google-beta"
name = "<%= ctx[:vars]['home_region_backend_service_name'] %>"
protocol = "HTTP"
timeout_sec = 10

health_checks = [google_compute_region_health_check.default.self_link]
load_balancing_scheme = "INTERNAL_MANAGED"
}

resource "google_compute_region_health_check" "default" {
provider = "google-beta"
name = "<%= ctx[:vars]['region_health_check_name'] %>"
http_health_check {
port = 80
}
}

Loading

0 comments on commit 732ba39

Please sign in to comment.