amazon-web-services - 如何使用 terraform 将来自不同区域 (us-east1) 的 ACM 证书附加到另一个区域中的应用程序负载均衡器

标签 amazon-web-services terraform terraform-provider-aws aws-acm

我使用 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/

相关文章:

amazon-web-services - Terraform 在配置 S3 后端时出错

amazon-web-services - fuse : device not found, 在 docker 容器上安装 s3 存储桶时首先尝试 'modprobe fuse'

amazon-web-services - 如何为常见的负载均衡器组织 terraform 模块

Terraform - 未在根模块中声明托管资源

amazon-web-services - 使用依赖存储桶名称的模板设置 S3 存储桶策略时如何避免循环错误?

terraform - 您可以使用 Terraform 在 AWS 安全组的入站规则上标记入站名称吗?

python - AgeRange 不在 Rekognition 响应中

amazon-web-services - 具有导出值和 Taskcat 的 CloudFormation 堆栈

powershell - 在 AWS 上的 Packer 中使用 PowerShell 禁用 Internet Explorer 增强的安全配置失败

amazon-web-services - Terraform 路由表强制每次应用新资源