forked from GoogleCloudPlatform/magic-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add fields pathTemplateMatch and pathTemplateRewrite to resource goog…
…le_compute_region_url_map (GoogleCloudPlatform#10157)
- Loading branch information
1 parent
749495d
commit 8e59d15
Showing
2 changed files
with
128 additions
and
0 deletions.
There are no files selected for viewing
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
90 changes: 90 additions & 0 deletions
90
mmv1/templates/terraform/examples/region_url_map_path_template_match.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,90 @@ | ||
# [START cloudloadbalancing_url_map_path_template_match] | ||
resource "google_compute_region_url_map" "<%= ctx[:primary_resource_id] %>" { | ||
region = "us-central1" | ||
|
||
name = "<%= ctx[:vars]['url_map_name'] %>" | ||
description = "a description" | ||
|
||
default_service = google_compute_region_backend_service.home-backend.id | ||
|
||
host_rule { | ||
hosts = ["mysite.com"] | ||
path_matcher = "mysite" | ||
} | ||
|
||
path_matcher { | ||
name = "mysite" | ||
default_service = google_compute_region_backend_service.home-backend.id | ||
|
||
route_rules { | ||
match_rules { | ||
path_template_match = "/xyzwebservices/v2/xyz/users/{username=*}/carts/{cartid=**}" | ||
} | ||
service = google_compute_region_backend_service.cart-backend.id | ||
priority = 1 | ||
route_action { | ||
url_rewrite { | ||
path_template_rewrite = "/{username}-{cartid}/" | ||
} | ||
} | ||
} | ||
|
||
route_rules { | ||
match_rules { | ||
path_template_match = "/xyzwebservices/v2/xyz/users/*/accountinfo/*" | ||
} | ||
service = google_compute_region_backend_service.user-backend.id | ||
priority = 2 | ||
} | ||
} | ||
} | ||
|
||
resource "google_compute_region_backend_service" "home-backend" { | ||
region = "us-central1" | ||
|
||
name = "<%= ctx[:vars]['home_backend_service_name'] %>" | ||
port_name = "http" | ||
protocol = "HTTP" | ||
timeout_sec = 10 | ||
load_balancing_scheme = "EXTERNAL_MANAGED" | ||
|
||
health_checks = [google_compute_region_health_check.default.id] | ||
} | ||
|
||
resource "google_compute_region_backend_service" "cart-backend" { | ||
region = "us-central1" | ||
|
||
name = "<%= ctx[:vars]['cart_backend_service_name'] %>" | ||
port_name = "http" | ||
protocol = "HTTP" | ||
timeout_sec = 10 | ||
load_balancing_scheme = "EXTERNAL_MANAGED" | ||
|
||
health_checks = [google_compute_region_health_check.default.id] | ||
} | ||
|
||
resource "google_compute_region_backend_service" "user-backend" { | ||
region = "us-central1" | ||
|
||
name = "<%= ctx[:vars]['user_backend_service_name'] %>" | ||
port_name = "http" | ||
protocol = "HTTP" | ||
timeout_sec = 10 | ||
load_balancing_scheme = "EXTERNAL_MANAGED" | ||
|
||
health_checks = [google_compute_region_health_check.default.id] | ||
} | ||
|
||
resource "google_compute_region_health_check" "default" { | ||
region = "us-central1" | ||
|
||
name = "<%= ctx[:vars]['health_check_name'] %>" | ||
check_interval_sec = 1 | ||
timeout_sec = 1 | ||
http_health_check { | ||
port = 80 | ||
request_path = "/" | ||
} | ||
} | ||
|
||
# [END cloudloadbalancing_url_map_path_template_match] |