简体   繁体   English

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

[英]Terraform - Error: no matching Route53Zone found

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

I want to run this module on serval domains: "example.com", "cdn.example.com"...我想在服务域上运行此模块:“example.com”、“cdn.example.com”...

I don't want to use subject_alternative_names for cdn.example.com because it will be appear on the subject field inside the certificate, and when everyone open the certificate I don't want to him to see cdn domain.我不想给cdn.example.com使用subject_alternative_names ,因为它会出现在证书里面的subject字段,大家打开证书的时候我不想让他看到cdn域名。

For cdn.example.com I want a new certificate.对于 cdn.example.com,我想要一个新证书。

So I try to run terraform apply with my code below but I getting errors:所以我尝试使用下面的代码运行terraform apply但出现错误:

Error: no matching Route53Zone found错误:找不到匹配的 Route53Zone

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

Error: no matching Route53Zone found错误:找不到匹配的 Route53Zone

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

I can't run more than more module?我不能运行更多的模块? How to solve it anyway?无论如何如何解决它?

main.tf主程序

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"
}

I only have example.com in the hosted zone.我在托管区域中只有example.com

Based on the comments.根据评论。

The issue was caused by using process_domain_validation_options = true .该问题是由使用process_domain_validation_options = true引起的。 This checks if the hosted zone exists in Roure53 prior requesting a certificate.这会在请求证书之前检查托管区域是否存在于 Roure53 中。 This is done to enable automated validation of the SSL certificate to be issued.这样做是为了启用对要颁发的 SSL 证书的自动验证

Since in the OP's case SSL certificates are requested for domains without corresponding zones, the terraform was erroring out.由于在 OP 的情况下,为没有相应区域的域请求 SSL 证书,因此 terraform 出错了。

The solution was to use process_domain_validation_options = false , but this requires manual validation procedure for the SSL to be issued.解决方案是使用process_domain_validation_options = false ,但这需要对要发布的 SSL 执行手动验证程序。 To automation of this procedure must be done through a custom solution.要使此过程自动化,必须通过自定义解决方案来完成。 In very broad terms, such solution could involve created required record for the validation using aws_route53_record , a lambda function or local-exec provisioner to created needed records.从广义上讲,此类解决方案可能涉及使用aws_route53_record 、 lambda function 或local-exec供应商创建验证所需的记录以创建所需的记录。

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

相关问题 使用 Terraform 在 Route 53 中跨账户子域/托管区域委派 - Cross-account subdomain/hosted zone delegation in Route 53 with Terraform 如何解决 AWS Route 53 中的错误 - 导入区域文件错误:多个不同的 TTL 值? - How to resolve error in AWS Route 53 - import zone file error : Multiple Distinct TTL values? Terraform 构建变更集时出错:循环遍历多个 Route53 记录时 InvalidChangeBatch - Terraform error building changeset: InvalidChangeBatch when looping through multiple Route53 Records 是否可以使用 apex 域将 Route 53 托管区域连接到 Lightsail 容器服务? - Is it possible to connect a Route 53 hosted zone to Lightsail Container Service using the apex domain? AWS Route 53 按创建日期列出记录 - AWS Route 53 list records by creation date AWS APIGateway 仅来自 route53 - AWS APIGateway From route53 only Apex 域重定向到 www Route 53 - Apex domain redirect to www Route 53 如何在没有 Route 53 的情况下运行 CloudFront - How to run CloudFront without Route 53 使用 AWS CloudFormation json 创建堆栈时 AWS::Route53::RecordSet 中出现无效请求错误 - Invalid request error in AWS::Route53::RecordSet when creating stack with AWS CloudFormation json 在 AWS Secrets Manager awscli 中收到错误:通过 Terraform 部署时找不到版本“AWSCURRENT” - Receiving error in AWS Secrets manager awscli for: Version "AWSCURRENT" not found when deployed via Terraform
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM