Skip to content

Commit

Permalink
Add route_rules to UrlMap for Traffic Director (#2748)
Browse files Browse the repository at this point in the history
Merged PR #2748.
  • Loading branch information
Ty Larrabee authored and modular-magician committed Dec 6, 2019
1 parent 937646c commit 1d93b45
Show file tree
Hide file tree
Showing 10 changed files with 1,362 additions and 55 deletions.
2 changes: 1 addition & 1 deletion build/ansible
2 changes: 1 addition & 1 deletion build/inspec
Submodule inspec updated 37 files
+242 −12 docs/resources/google_compute_url_map.md
+2 −1 docs/resources/google_compute_url_maps.md
+45 −0 libraries/google/compute/property/urlmap_header_action.rb
+48 −0 libraries/google/compute/property/urlmap_header_action_request_headers_to_add.rb
+48 −0 libraries/google/compute/property/urlmap_header_action_response_headers_to_add.rb
+12 −2 libraries/google/compute/property/urlmap_path_matchers.rb
+45 −0 libraries/google/compute/property/urlmap_path_matchers_header_action.rb
+48 −0 libraries/google/compute/property/urlmap_path_matchers_header_action_request_headers_to_add.rb
+48 −0 libraries/google/compute/property/urlmap_path_matchers_header_action_response_headers_to_add.rb
+71 −0 libraries/google/compute/property/urlmap_path_matchers_route_rules.rb
+45 −0 libraries/google/compute/property/urlmap_path_matchers_route_rules_header_action.rb
+48 −0 libraries/google/compute/property/urlmap_path_matchers_route_rules_header_action_request_headers_to_add.rb
+48 −0 libraries/google/compute/property/urlmap_path_matchers_route_rules_header_action_response_headers_to_add.rb
+63 −0 libraries/google/compute/property/urlmap_path_matchers_route_rules_match_rules.rb
+64 −0 libraries/google/compute/property/urlmap_path_matchers_route_rules_match_rules_header_matches.rb
+37 −0 libraries/google/compute/property/urlmap_path_matchers_route_rules_match_rules_header_matches_range_match.rb
+46 −0 libraries/google/compute/property/urlmap_path_matchers_route_rules_match_rules_metadata_filters.rb
+45 −0 ...ries/google/compute/property/urlmap_path_matchers_route_rules_match_rules_metadata_filters_filter_labels.rb
+51 −0 libraries/google/compute/property/urlmap_path_matchers_route_rules_match_rules_query_parameter_matches.rb
+63 −0 libraries/google/compute/property/urlmap_path_matchers_route_rules_route_action.rb
+55 −0 libraries/google/compute/property/urlmap_path_matchers_route_rules_route_action_cors_policy.rb
+40 −0 libraries/google/compute/property/urlmap_path_matchers_route_rules_route_action_fault_injection_policy.rb
+37 −0 ...aries/google/compute/property/urlmap_path_matchers_route_rules_route_action_fault_injection_policy_abort.rb
+38 −0 ...aries/google/compute/property/urlmap_path_matchers_route_rules_route_action_fault_injection_policy_delay.rb
+37 −0 .../compute/property/urlmap_path_matchers_route_rules_route_action_fault_injection_policy_delay_fixed_delay.rb
+34 −0 libraries/google/compute/property/urlmap_path_matchers_route_rules_route_action_request_mirror_policy.rb
+41 −0 libraries/google/compute/property/urlmap_path_matchers_route_rules_route_action_retry_policy.rb
+37 −0 ...aries/google/compute/property/urlmap_path_matchers_route_rules_route_action_retry_policy_per_try_timeout.rb
+37 −0 libraries/google/compute/property/urlmap_path_matchers_route_rules_route_action_timeout.rb
+37 −0 libraries/google/compute/property/urlmap_path_matchers_route_rules_route_action_url_rewrite.rb
+51 −0 libraries/google/compute/property/urlmap_path_matchers_route_rules_route_action_weighted_backend_services.rb
+45 −0 ...e/compute/property/urlmap_path_matchers_route_rules_route_action_weighted_backend_services_header_action.rb
+48 −0 ...ap_path_matchers_route_rules_route_action_weighted_backend_services_header_action_request_headers_to_add.rb
+48 −0 ...p_path_matchers_route_rules_route_action_weighted_backend_services_header_action_response_headers_to_add.rb
+49 −0 libraries/google/compute/property/urlmap_path_matchers_route_rules_url_redirect.rb
+7 −2 libraries/google_compute_url_map.rb
+4 −2 libraries/google_compute_url_maps.rb
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
944 changes: 894 additions & 50 deletions products/compute/api.yaml

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions products/compute/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1983,6 +1983,24 @@ overrides: !ruby/object:Overrides::ResourceOverrides
http_health_check_name: "health-check"
backend_bucket_name: "static-asset-backend-bucket"
storage_bucket_name: "static-asset-bucket"
- !ruby/object:Provider::Terraform::Examples
name: "url_map_traffic_director_route"
primary_resource_id: "urlmap"
vars:
url_map_name: "urlmap"
home_backend_service_name: "home"
health_check_name: "health-check"
backend_bucket_name: "static-asset-backend-bucket"
storage_bucket_name: "static-asset-bucket"
- !ruby/object:Provider::Terraform::Examples
name: "url_map_traffic_director_route_partial"
primary_resource_id: "urlmap"
vars:
url_map_name: "urlmap"
home_backend_service_name: "home"
health_check_name: "health-check"
backend_bucket_name: "static-asset-backend-bucket"
storage_bucket_name: "static-asset-bucket"
properties:
id: !ruby/object:Overrides::Terraform::PropertyOverride
name: "map_id"
Expand Down
83 changes: 83 additions & 0 deletions templates/terraform/examples/url_map_traffic_director_route.tf.erb
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
}
}
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
}
}
Loading

0 comments on commit 1d93b45

Please sign in to comment.