ALB module v9 → v10
Who is affected
load-balancing-alb stacks that define custom rules with actions in their override (e.g. _gp_alb_override.tf).
If you have no custom rules, this guide does not apply to you.
What changed
Listener rule actions
The type field is replaced by a nested object named after the action type.
Before (v9):
rules = {
metrics = {
actions = [
{
type = "fixed-response"
content_type = "text/plain"
status_code = "404"
}
]
}
}
After (v10):
rules = {
metrics = {
actions = [
{
fixed_response = {
content_type = "text/plain"
status_code = "404"
}
}
]
}
}
Other action types
The same pattern applies to all action types:
# v9: forward
actions = [{ type = "forward", target_group_key = "my-tg" }]
# v10: forward
actions = [{ forward = { target_group_key = "my-tg" } }]
# v9: redirect
actions = [{ type = "redirect", port = "443", protocol = "HTTPS", status_code = "HTTP_301" }]
# v10: redirect
actions = [{ redirect = { port = "443", protocol = "HTTPS", status_code = "HTTP_301" } }]
Query string conditions
If you use query_string in conditions, it changed from a map to a list of maps:
# v9
conditions = [{ query_string = { key = "foo", value = "bar" } }]
# v10
conditions = [{ query_string = [{ key = "foo", value = "bar" }] }]
How to upgrade
- Find any
_gp_alb_override.tf(or similar override) that definesruleswithactions - Replace
type = "<action-type>"+ flat fields with<action-type> = { ... }nested block - Update any
query_stringconditions to the list-of-maps format - Run
terraform plan- verify changes. Note: upgrade to v10 will remove someterraform-aws-modules = "alb"tags