我使用 terraform 在 ap-southeast-1 中设置了我的 AWS 基础设施,但是,我想链接我的 使用 aws_alb_listener 资源在 us-east1 中为我的负载均衡器创建的 ACM 证书。
resource "aws_alb_listener" "https" {
load_balancer_arn = aws_lb.main.id
port = 443
protocol = "HTTPS"
ssl_policy = "ELBSecurityPolicy-2016-08"
certificate_arn = var.acm_certificate_arn
depends_on = [aws_alb_target_group.main]
default_action {
target_group_arn = aws_alb_target_group.main.arn
type = "forward"
}
}
当我应用 terraform 时,它会引发错误。
是否可以使用 terraform 将 ACM 证书附加到来自不同区域的 alb?
我的用例是此证书还将在 AWS CloudFront 中用作 CDN。
最佳答案
Is it possible to attach an ACM certificate to alb from a different region using terraform?
很遗憾,这是不可能的。 ACM 证书只能在其创建的区域使用,不包括 CloudFront 等全局资源。
对于您的 ALB,您必须在 ALB 的区域中创建新的 ACM 并将其注册到同一域。来自 AWS blog :
ACM certificates must be requested or imported in the same AWS Region as your load balancer. Amazon CloudFront distributions must request the certificate in the US East (N. Virginia) Region.
关于amazon-web-services - 如何使用 terraform 将来自不同区域 (us-east1) 的 ACM 证书附加到另一个区域中的应用程序负载均衡器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66206034/