Add support for custom error response policies to net_lb_app_ext module (#2916)
* Add support for default custom error response policy This update introduces the ability to define a default custom error response policy in the URL map module. It includes support for specifying error services and error response rules with match response codes, paths, and override response codes. This enhancement increases flexibility in handling custom error responses. * Update error_service handling in URL map Modified the error_service assignment to include a fallback lookup mechanism for backend IDs when the value is not null. This ensures robustness and avoids null references while maintaining existing behavior. * Add custom error response policies in lower levels of URL map * Update net-lb-app-ext README.md
This commit is contained in:
@@ -36,6 +36,31 @@ resource "google_compute_url_map" "default" {
|
||||
)
|
||||
)
|
||||
|
||||
dynamic "default_custom_error_response_policy" {
|
||||
for_each = (
|
||||
var.urlmap_config.default_custom_error_response_policy == null
|
||||
? []
|
||||
: [var.urlmap_config.default_custom_error_response_policy]
|
||||
)
|
||||
iterator = p
|
||||
content {
|
||||
error_service = p.value.error_service == null ? null : lookup(
|
||||
local.backend_ids,
|
||||
p.value.error_service,
|
||||
p.value.error_service
|
||||
)
|
||||
dynamic "error_response_rule" {
|
||||
for_each = coalesce(p.value.error_response_rules, [])
|
||||
iterator = r
|
||||
content {
|
||||
match_response_codes = r.value.match_response_codes
|
||||
path = r.value.path
|
||||
override_response_code = r.value.override_response_code
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dynamic "default_route_action" {
|
||||
for_each = (
|
||||
var.urlmap_config.default_route_action == null
|
||||
@@ -261,6 +286,30 @@ resource "google_compute_url_map" "default" {
|
||||
)
|
||||
description = m.value.description
|
||||
name = m.key
|
||||
dynamic "default_custom_error_response_policy" {
|
||||
for_each = (
|
||||
m.value.default_custom_error_response_policy == null
|
||||
? []
|
||||
: [m.value.default_custom_error_response_policy]
|
||||
)
|
||||
iterator = p
|
||||
content {
|
||||
error_service = p.value.error_service == null ? null : lookup(
|
||||
local.backend_ids,
|
||||
p.value.error_service,
|
||||
p.value.error_service
|
||||
)
|
||||
dynamic "error_response_rule" {
|
||||
for_each = coalesce(p.value.error_response_rules, [])
|
||||
iterator = r
|
||||
content {
|
||||
match_response_codes = r.value.match_response_codes
|
||||
path = r.value.path
|
||||
override_response_code = r.value.override_response_code
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
dynamic "default_route_action" {
|
||||
for_each = (
|
||||
m.value.default_route_action == null
|
||||
@@ -472,6 +521,30 @@ resource "google_compute_url_map" "default" {
|
||||
path_rule.value.service,
|
||||
path_rule.value.service
|
||||
)
|
||||
dynamic "custom_error_response_policy" {
|
||||
for_each = (
|
||||
path_rule.value.custom_error_response_policy == null
|
||||
? []
|
||||
: [path_rule.value.custom_error_response_policy]
|
||||
)
|
||||
iterator = p
|
||||
content {
|
||||
error_service = p.value.error_service == null ? null : lookup(
|
||||
local.backend_ids,
|
||||
p.value.error_service,
|
||||
p.value.error_service
|
||||
)
|
||||
dynamic "error_response_rule" {
|
||||
for_each = coalesce(p.value.error_response_rules, [])
|
||||
iterator = r
|
||||
content {
|
||||
match_response_codes = r.value.match_response_codes
|
||||
path = r.value.path
|
||||
override_response_code = r.value.override_response_code
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
dynamic "route_action" {
|
||||
for_each = (
|
||||
path_rule.value.route_action == null
|
||||
|
||||
Reference in New Issue
Block a user