Skip to content

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

  1. Find any _gp_alb_override.tf (or similar override) that defines rules with actions
  2. Replace type = "<action-type>" + flat fields with <action-type> = { ... } nested block
  3. Update any query_string conditions to the list-of-maps format
  4. Run terraform plan - verify changes. Note: upgrade to v10 will remove some terraform-aws-modules = "alb" tags

References