Ela34
Ela34

Reputation: 61

Setting multiple certificates on an aws_lb_listener using terraform

Using terraform, is there a way using aws_lb_listener to set multiple certificate arn?

Practicallyit seems "certificate_arn" field is accepting only one certificate arn. Is there a trick to add multiple certificates arn?

Something like:

resource "aws_lb_listener" "https" {
  certificate_arn     = ["${var.certificate1_arn}", "${var.certificate2_arn}"]

}

Upvotes: 6

Views: 8274

Answers (2)

Clintm
Clintm

Reputation: 4877

Seems like this is possible now with https://www.terraform.io/docs/providers/aws/r/lb_listener_certificate.html

This resource is for additional certificates and does not replace the default certificate on the listener.

resource "aws_lb_listener" "front_end" {
  # ...
}

resource "aws_lb_listener_certificate" "example" {
  listener_arn    = "${aws_lb_listener.front_end.arn}"
  certificate_arn = "${aws_acm_certificate.example.arn}"
}

Upvotes: 15

ExploringApple
ExploringApple

Reputation: 1484

Hashicorp terraform currently not supporting attaching multiple SSL certificates.

Although AWS ALB supports multiple SSL certificates.

https://aws.amazon.com/about-aws/whats-new/2017/10/elastic-load-balancing-application-load-balancers-now-support-multiple-ssl-certificates-and-smart-certificate-selection-using-server-name-indication-sni/

You can use aws cloudformation though.

Upvotes: 1

Related Questions