hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.85k stars 9.2k forks source link

[New Data Source]: `aws_acm_certificates` #40167

Open mss opened 6 days ago

mss commented 6 days ago

Description

A data source aws_acm_certificates (plural) would be useful for looking up the ARNs of multiple (potentially optional) certificates for SNI based selection and/or deploying both RSA and ECDSA certificates to an ALB.

Requested Resource(s) and/or Data Source(s)

Potential Terraform Configuration

data "aws_acm_certificate" "primary" {
  domain   = var.primary_domain
  statuses = ["ISSUED"]
}

data "aws_acm_certificates" "aliases" {
  for_each = toset(var.alias_domains)

  domain    = each.key
  statuses  = ["ISSUED"]
  key_types = ["RSA_2048", "EC_prime256v1"]
}

resource "aws_lb_listener" "this" {
  load_balancer_arn = aws_lb.this.arn
  port              = "443"
  protocol          = "HTTPS"
  certificate_arn   = data.aws_acm_certificate.primary.arn

  ...
}

resource "aws_lb_listener_certificate" "this" {
  for_each = data.aws_acm_certificates

  listener_arn    = aws_lb_listener.this.arn
  certificate_arn = each.value.arn
}

References

Would you like to implement a fix?

No

github-actions[bot] commented 6 days ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue