Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add route_rules to RegionUrlMap #2807

Merged
merged 3 commits into from
Dec 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'] %>"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spacing again

http_health_check {
port = 80
}
}

Loading