繁体   English   中英

Terraform - 错误:找不到匹配的 Route53Zone

[英]Terraform - Error: no matching Route53Zone found

我使用https://github.com/cloudposse/terraform-aws-acm-request-certificate使用 terraform 和 aws 生成证书。

我想在服务域上运行此模块:“example.com”、“cdn.example.com”...

我不想给cdn.example.com使用subject_alternative_names ,因为它会出现在证书里面的subject字段,大家打开证书的时候我不想让他看到cdn域名。

对于 cdn.example.com,我想要一个新证书。

所以我尝试使用下面的代码运行terraform apply但出现错误:

错误:找不到匹配的 Route53Zone

on.terraform\modules\acm_request_certificate_example\main.tf 第 19 行,在数据“aws_route53_zone”“默认”中:19:数据“aws_route53_zone”“默认”{

错误:找不到匹配的 Route53Zone

on.terraform\modules\acm_request_certificate_cdn_example\main.tf 第 19 行,在数据“aws_route53_zone”“默认”中:19:数据“aws_route53_zone”“默认”{

我不能运行更多的模块? 无论如何如何解决它?

主程序

terraform {
  required_version = "~> 0.12.0"
}

provider "aws" {
  version = "~> 2.12.0"
  region  = "us-east-1"
}
module "acm_request_certificate_example" {
  source                            = "git::https://github.com/cloudposse/terraform-aws-acm-request-certificate.git?ref=master"
  domain_name                       = "example.com"
  process_domain_validation_options = true
  ttl                               = "300"
}

module "acm_request_certificate_cdn_example" {
  source                            = "git::https://github.com/cloudposse/terraform-aws-acm-request-certificate.git?ref=master"
  domain_name                       = "cdn.example.com"
  process_domain_validation_options = true
  ttl                               = "300"
}

我在托管区域中只有example.com

根据评论。

该问题是由使用process_domain_validation_options = true引起的。 这会在请求证书之前检查托管区域是否存在于 Roure53 中。 这样做是为了启用对要颁发的 SSL 证书的自动验证

由于在 OP 的情况下,为没有相应区域的域请求 SSL 证书,因此 terraform 出错了。

解决方案是使用process_domain_validation_options = false ,但这需要对要发布的 SSL 执行手动验证程序。 要使此过程自动化,必须通过自定义解决方案来完成。 从广义上讲,此类解决方案可能涉及使用aws_route53_record 、 lambda function 或local-exec供应商创建验证所需的记录以创建所需的记录。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM