【发布时间】:2020-03-29 10:06:20
【问题描述】:
假设我有一个公共托管区域service.example.com.。我们有此代码在包含 API 网关的配置中工作。我们决定将 CNAME ALIAS 绑定到 ECS 集群前面的 ALB/NLB。我们打算稍后将证书添加到 ALB/NLB 并放入 WAF。但是,我们需要先完成这项工作,然后再进行这些工作。
此托管区域存储在变量 domain_suffix 中,不带点为service.example.com。
我正在为 ALB/NLB 及其与 ECS 的集成使用自定义 terraform 模块。
data "aws_route53_zone" "public_zone" {
name = var.domain_suffix
private_zone = false
}
在 terraform plan 期间出现此错误:
Error: no matching Route53Zone found
on ../prod/modules/regional-service/data.tf line 12, in data "aws_route53_zone" "public_zone":
12: data "aws_route53_zone" "public_zone" {
Route53 代码如下:
resource "aws_route53_record" "a-record" {
name = local.regional_subdomain
type = "A"
zone_id = data.aws_route53_zone.public_zone.id
alias {
name = data.aws_lb.bridged-lb.dns_name
zone_id = data.aws_lb.bridged-lb.zone_id
evaluate_target_health = true
}
}
resource "aws_route53_health_check" "health_check" {
port = 443
type = "HTTPS"
resource_path = "/version"
fqdn = local.regional_subdomain
failure_threshold = "5"
request_interval = "30"
tags = local.tags
}
resource "aws_route53_record" "cname" {
name = local.global_subdomain
records = [local.regional_subdomain]
set_identifier = "${var.service_name}-${var.region}"
ttl = "60"
type = "CNAME"
zone_id = data.aws_route53_zone.public_zone.id
health_check_id = aws_route53_health_check.health_check.id
latency_routing_policy {
region = var.region
}
}
对于解决此问题的任何帮助,我将不胜感激。 非常感谢您。
【问题讨论】:
-
那个 Route53 区域在那个 AWS 账户中吗?
-
@ydaetskcoR,我刚刚意识到我可能在错误的帐户中。请让我看看这个并回复你。
-
@ydaetskcoR,我现在已经获得了正确的帐户详细信息和正确的匹配公共托管区域,现在一切都很好。非常感谢。
标签: terraform amazon-ecs amazon-route53 amazon-elb