How to add/attach multiple ACM certificates to an AWS load balancer in Terraform

Ly Channa
1 min readJan 26, 2022

You might have a need to attach multiple certs to your AWS application load balancer, for example, you might have the domains,, and so on to be served by the same app using AWS Application load balancer in front of your application that deployed to EC2, ElasticBeanstalk or Elastic container services.

In my case, I am handling a multi-tenancy SaaS application that handles one or more domains per tenant and as you might have guessed I use Terraform to manage the infrastructure. Before terraform I used to set up this thing manually using the Amazon Console which is very prone to errors and not agile enough.

Terraform comes with aws_lb_listener_certificate that allows you to attach a certificate to any aws_lb_listerner as shown below:

resource "aws_lb_listener_certificate" "https_additional_certs" {  
count = length(var.additional_certs)
listener_arn = aws_lb_listener.https.arn
certificate_arn = var.additional_certs[count.index]

A complete terraform code can be found in the gist here: