diff --git a/modules/net-lb-app-ext-regional/README.md b/modules/net-lb-app-ext-regional/README.md
index aaf3145a65..c3be9aecbe 100644
--- a/modules/net-lb-app-ext-regional/README.md
+++ b/modules/net-lb-app-ext-regional/README.md
@@ -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/variables-urlmap.tf b/modules/net-lb-app-ext-regional/variables-urlmap.tf
index 9e12283710..385cf687e7 100644
--- a/modules/net-lb-app-ext-regional/variables-urlmap.tf
+++ b/modules/net-lb-app-ext-regional/variables-urlmap.tf
@@ -204,7 +204,7 @@ variable "urlmap_config" {
headers = optional(list(object({
name = string
invert_match = optional(bool, false)
- type = optional(string, "present") # exact, prefix, suffix, regex, present, range
+ type = optional(string, "present") # exact, prefix, suffix, regex, present, range, template
value = optional(string)
range_value = optional(object({
end = string
diff --git a/modules/net-lb-app-ext/README.md b/modules/net-lb-app-ext/README.md
index 8f51535f01..b11c8d5409 100644
--- a/modules/net-lb-app-ext/README.md
+++ b/modules/net-lb-app-ext/README.md
@@ -1060,7 +1060,7 @@ After provisioning this change, and verifying that the new certificate is provis
| [ports](variables.tf#L189) | Optional ports for HTTP load balancer, valid ports are 80 and 8080. | list(string)
| | null
|
| [protocol](variables.tf#L200) | Protocol supported by this load balancer. | string
| | "HTTP"
|
| [ssl_certificates](variables.tf#L213) | 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({…})
| | {…}
|
| [use_classic_version](variables.tf#L230) | Use classic Global Load Balancer. | bool
| | true
|
## Outputs
diff --git a/modules/net-lb-app-ext/variables-urlmap.tf b/modules/net-lb-app-ext/variables-urlmap.tf
index c7745e4a25..2a3b2e7110 100644
--- a/modules/net-lb-app-ext/variables-urlmap.tf
+++ b/modules/net-lb-app-ext/variables-urlmap.tf
@@ -143,9 +143,8 @@ variable "urlmap_config" {
nanos = optional(number)
}))
url_rewrite = optional(object({
- host = optional(string)
- path_prefix = optional(string)
- path_template = optional(string)
+ host = optional(string)
+ path_prefix = optional(string)
}))
weighted_backend_services = optional(map(object({
weight = number
@@ -273,7 +272,7 @@ variable "urlmap_config" {
headers = optional(list(object({
name = string
invert_match = optional(bool, false)
- type = optional(string, "present") # exact, prefix, suffix, regex, present, range
+ type = optional(string, "present") # exact, prefix, suffix, regex, present, range, template
value = optional(string)
range_value = optional(object({
end = string
diff --git a/modules/net-lb-app-int-cross-region/README.md b/modules/net-lb-app-int-cross-region/README.md
index f6debd1c30..0904633010 100644
--- a/modules/net-lb-app-int-cross-region/README.md
+++ b/modules/net-lb-app-int-cross-region/README.md
@@ -764,7 +764,7 @@ For deploying changes to load balancer configuration please refer to [net-lb-app
| [ports](variables.tf#L129) | Optional ports for HTTP load balancer, valid ports are 80 and 8080. | list(string)
| | null
|
| [protocol](variables.tf#L140) | Protocol supported by this load balancer. | string
| | "HTTP"
|
| [service_directory_registration](variables.tf#L153) | Service directory namespace and service used to register this load balancer. | object({…})
| | null
|
-| [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-int-cross-region/urlmap.tf b/modules/net-lb-app-int-cross-region/urlmap.tf
index 753fcc6131..62ccd9a924 100644
--- a/modules/net-lb-app-int-cross-region/urlmap.tf
+++ b/modules/net-lb-app-int-cross-region/urlmap.tf
@@ -326,6 +326,11 @@ resource "google_compute_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
@@ -496,8 +501,9 @@ resource "google_compute_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-int-cross-region/variables-urlmap.tf b/modules/net-lb-app-int-cross-region/variables-urlmap.tf
index 9e52e5782e..ee48b7df0d 100644
--- a/modules/net-lb-app-int-cross-region/variables-urlmap.tf
+++ b/modules/net-lb-app-int-cross-region/variables-urlmap.tf
@@ -133,7 +133,7 @@ variable "urlmap_config" {
headers = optional(list(object({
name = string
invert_match = optional(bool, false)
- type = optional(string, "present") # exact, prefix, suffix, regex, present, range
+ type = optional(string, "present") # exact, prefix, suffix, regex, present, range, template
value = optional(string)
range_value = optional(object({
end = string
@@ -192,8 +192,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
diff --git a/modules/net-lb-app-int/README.md b/modules/net-lb-app-int/README.md
index 136406f4f9..0d268045dd 100644
--- a/modules/net-lb-app-int/README.md
+++ b/modules/net-lb-app-int/README.md
@@ -757,7 +757,7 @@ For deploying changes to load balancer configuration please refer to [net-lb-app
| [service_attachment](variables.tf#L183) | PSC service attachment. | object({…})
| | null
|
| [service_directory_registration](variables.tf#L198) | Service directory namespace and service used to register this load balancer. | object({…})
| | null
|
| [ssl_certificates](variables.tf#L207) | SSL target proxy certificates (only if protocol is HTTPS). | 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-int/urlmap.tf b/modules/net-lb-app-int/urlmap.tf
index 3fd01270be..d680beb035 100644
--- a/modules/net-lb-app-int/urlmap.tf
+++ b/modules/net-lb-app-int/urlmap.tf
@@ -327,6 +327,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
@@ -497,8 +502,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-int/variables-urlmap.tf b/modules/net-lb-app-int/variables-urlmap.tf
index 9e52e5782e..ee48b7df0d 100644
--- a/modules/net-lb-app-int/variables-urlmap.tf
+++ b/modules/net-lb-app-int/variables-urlmap.tf
@@ -133,7 +133,7 @@ variable "urlmap_config" {
headers = optional(list(object({
name = string
invert_match = optional(bool, false)
- type = optional(string, "present") # exact, prefix, suffix, regex, present, range
+ type = optional(string, "present") # exact, prefix, suffix, regex, present, range, template
value = optional(string)
range_value = optional(object({
end = string
@@ -192,8 +192,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