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 path_rules to UrlMap #2798

Merged
merged 3 commits into from
Dec 9, 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/inspec
Submodule inspec updated 19 files
+114 −6 docs/resources/google_compute_url_map.md
+3 −3 libraries/google/compute/property/urlmap_path_matchers.rb
+21 −2 libraries/google/compute/property/urlmap_path_matchers_path_rules.rb
+63 −0 libraries/google/compute/property/urlmap_path_matchers_path_rules_route_action.rb
+55 −0 libraries/google/compute/property/urlmap_path_matchers_path_rules_route_action_cors_policy.rb
+40 −0 libraries/google/compute/property/urlmap_path_matchers_path_rules_route_action_fault_injection_policy.rb
+37 −0 libraries/google/compute/property/urlmap_path_matchers_path_rules_route_action_fault_injection_policy_abort.rb
+38 −0 libraries/google/compute/property/urlmap_path_matchers_path_rules_route_action_fault_injection_policy_delay.rb
+37 −0 ...e/compute/property/urlmap_path_matchers_path_rules_route_action_fault_injection_policy_delay_fixed_delay.rb
+34 −0 libraries/google/compute/property/urlmap_path_matchers_path_rules_route_action_request_mirror_policy.rb
+41 −0 libraries/google/compute/property/urlmap_path_matchers_path_rules_route_action_retry_policy.rb
+37 −0 libraries/google/compute/property/urlmap_path_matchers_path_rules_route_action_retry_policy_per_try_timeout.rb
+37 −0 libraries/google/compute/property/urlmap_path_matchers_path_rules_route_action_timeout.rb
+37 −0 libraries/google/compute/property/urlmap_path_matchers_path_rules_route_action_url_rewrite.rb
+51 −0 libraries/google/compute/property/urlmap_path_matchers_path_rules_route_action_weighted_backend_services.rb
+45 −0 ...le/compute/property/urlmap_path_matchers_path_rules_route_action_weighted_backend_services_header_action.rb
+48 −0 ...map_path_matchers_path_rules_route_action_weighted_backend_services_header_action_request_headers_to_add.rb
+48 −0 ...ap_path_matchers_path_rules_route_action_weighted_backend_services_header_action_response_headers_to_add.rb
+49 −0 libraries/google/compute/property/urlmap_path_matchers_path_rules_url_redirect.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
434 changes: 411 additions & 23 deletions products/compute/api.yaml

Large diffs are not rendered by default.

18 changes: 14 additions & 4 deletions products/compute/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1988,17 +1988,27 @@ overrides: !ruby/object:Overrides::ResourceOverrides
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"
- !ruby/object:Provider::Terraform::Examples
name: "url_map_traffic_director_path"
primary_resource_id: "urlmap"
vars:
url_map_name: "urlmap"
home_backend_service_name: "home"
health_check_name: "health-check"
- !ruby/object:Provider::Terraform::Examples
name: "url_map_traffic_director_path_partial"
primary_resource_id: "urlmap"
vars:
url_map_name: "urlmap"
home_backend_service_name: "home"
health_check_name: "health-check"
properties:
id: !ruby/object:Overrides::Terraform::PropertyOverride
name: "map_id"
Expand Down
103 changes: 103 additions & 0 deletions templates/terraform/examples/url_map_traffic_director_path.tf.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
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}"

path_rule {
paths = ["/home"]
route_action {
cors_policy {
allow_credentials = true
allow_headers = ["Allowed content"]
allow_methods = ["GET"]
allow_origin_regexes = ["abc.*"]
allow_origins = ["Allowed origin"]
expose_headers = ["Exposed header"]
max_age = 30
disabled = false
}
fault_injection_policy {
abort {
http_status = 234
percentage = 5.6
}
delay {
fixed_delay {
seconds = 0
nanos = 50000
}
percentage = 7.8
}
}
request_mirror_policy {
backend_service = "${google_compute_backend_service.home.self_link}"
}
retry_policy {
num_retries = 4
per_try_timeout {
seconds = 30
}
retry_conditions = ["5xx", "deadline-exceeded"]
}
timeout {
seconds = 20
nanos = 750000000
}
url_rewrite {
host_rewrite = "A replacement header"
path_prefix_rewrite = "A replacement path"
}
weighted_backend_services {
backend_service = "${google_compute_backend_service.home.self_link}"
weight = 400
header_action {
request_headers_to_remove = ["RemoveMe"]
request_headers_to_add {
header_name = "AddMe"
header_value = "MyValue"
replace = true
}
response_headers_to_remove = ["RemoveMe"]
response_headers_to_add {
header_name = "AddMe"
header_value = "MyValue"
replace = false
}
}
}
}
}
}

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,73 @@
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}"

path_rule {
paths = ["/home"]
route_action {
cors_policy {
allow_credentials = true
allow_headers = ["Allowed content"]
allow_methods = ["GET"]
allow_origin_regexes = ["abc.*"]
allow_origins = ["Allowed origin"]
expose_headers = ["Exposed header"]
max_age = 30
disabled = false
}
weighted_backend_services {
backend_service = "${google_compute_backend_service.home.self_link}"
weight = 400
header_action {
request_headers_to_remove = ["RemoveMe"]
request_headers_to_add {
header_name = "AddMe"
header_value = "MyValue"
replace = true
}
response_headers_to_remove = ["RemoveMe"]
response_headers_to_add {
header_name = "AddMe"
header_value = "MyValue"
replace = false
}
}
}
}
}
}

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