How to create a new LB listener default action forwarding to several target groups?


the AWS Console allows to create new load-balancer listeners with the default action set to “forward” and associated with several target groups (with different weights). See that screenshot:

I’ve tried to have the same type of configuration using Terraform, but it looks like it’s not possible?

  • It’s possible to set a default action for a listener as “forward”, but only one target group is accepted here.
  • Adding several rules with action = forward to different target groups is similar but actually not completely as:
    1. the condition part is mandatory there;
    2. and it’s not possible to add different rules with the same priority and I didn’t any other place with this “weight” concept.

Is there something I’m missing or is it currently a limitation from Terraform (and/or the AWS API actually?)

Thanks for you help!


Looks as if the API’s been augmented:

// DefaultActions is a required field DefaultActions []*Action type:“list” required:“true”

It seems to be coming from the latest updates for the load-balancers:

This looks like the new “Weighted Target Groups for ALB” feature mentioned in this blog post.

You’re right @multani - here’s the feature request in the provider repository

1 Like