diff --git a/modules/net-lb-app-ext-regional/README.md b/modules/net-lb-app-ext-regional/README.md index 2e5127ebab..aaf3145a65 100644 --- a/modules/net-lb-app-ext-regional/README.md +++ b/modules/net-lb-app-ext-regional/README.md @@ -547,7 +547,7 @@ module "ralb-0" { default_service = "ralb-test-0-my_backend" } } -# tftest modules=1 resources=5 +# tftest modules=1 resources=5 ``` ### URL Map @@ -766,7 +766,7 @@ For deploying changes to load balancer configuration please refer to [net-lb-app | [ports](variables.tf#L145) | Optional ports for HTTP load balancer, valid ports are 80 and 8080. | list(string) | | null | | [protocol](variables.tf#L156) | Protocol supported by this load balancer. | string | | "HTTP" | | [ssl_certificates](variables.tf#L174) | SSL target proxy certificates (only if protocol is HTTPS) for existing, custom, and managed certificates. | object({…}) | | {} | -| [urlmap_config](variables-urlmap.tf#L19) | The URL map configuration. | object({…}) | | {…} | +| [urlmap_config](variables-urlmap.tf#L19) | The URL map configuration. | object({…}) | | {…} | ## Outputs diff --git a/modules/net-lb-app-ext-regional/urlmap.tf b/modules/net-lb-app-ext-regional/urlmap.tf index e305918d08..f88cc0a38d 100644 --- a/modules/net-lb-app-ext-regional/urlmap.tf +++ b/modules/net-lb-app-ext-regional/urlmap.tf @@ -487,6 +487,11 @@ resource "google_compute_region_url_map" "default" { ? match_rules.value.path.value : null ) + path_template_match = ( + try(match_rules.value.path.type, null) == "template" + ? match_rules.value.path.value + : null + ) dynamic "header_matches" { for_each = toset(coalesce(match_rules.value.headers, [])) iterator = h @@ -657,8 +662,9 @@ resource "google_compute_region_url_map" "default" { : [route_action.value.url_rewrite] ) content { - host_rewrite = url_rewrite.value.host - path_prefix_rewrite = url_rewrite.value.path_prefix + host_rewrite = url_rewrite.value.host + path_prefix_rewrite = url_rewrite.value.path_prefix + path_template_rewrite = url_rewrite.value.path_template } } dynamic "weighted_backend_services" { diff --git a/modules/net-lb-app-ext-regional/variables-urlmap.tf b/modules/net-lb-app-ext-regional/variables-urlmap.tf index 8694eb90b0..9e12283710 100644 --- a/modules/net-lb-app-ext-regional/variables-urlmap.tf +++ b/modules/net-lb-app-ext-regional/variables-urlmap.tf @@ -57,8 +57,9 @@ variable "urlmap_config" { nanos = optional(number) })) url_rewrite = optional(object({ - host = optional(string) - path_prefix = optional(string) + host = optional(string) + path_prefix = optional(string) + path_template = optional(string) })) weighted_backend_services = optional(map(object({ weight = number @@ -154,8 +155,9 @@ variable "urlmap_config" { nanos = optional(number) })) url_rewrite = optional(object({ - host = optional(string) - path_prefix = optional(string) + host = optional(string) + path_prefix = optional(string) + path_template = optional(string) })) weighted_backend_services = optional(map(object({ weight = number @@ -261,8 +263,9 @@ variable "urlmap_config" { nanos = optional(number) })) url_rewrite = optional(object({ - host = optional(string) - path_prefix = optional(string) + host = optional(string) + path_prefix = optional(string) + path_template = optional(string) })) weighted_backend_services = optional(map(object({ weight = number