错误:未找到匹配的 Route53Zone:尝试将 Route53 链接到 Amazon 负载均衡器时



假设我有一个公有托管区域service.example.com.。我们有此代码在包含 API 网关的配置中工作。我们决定将别名绑定到弹性云服务器集群前面的ALB/NLB。我们打算稍后将证书添加到 ALB/NLB 并放入 WAF。但是,我们需要在转向这些之前使其工作。

此托管区域存储在变量domain_suffix中,没有点作为service.example.com。 我正在使用用于 ALB/NLB 及其与 ECS 集成的自定义地形模块。

data "aws_route53_zone" "public_zone" {
name         = var.domain_suffix
private_zone = false
}

在地形规划期间,会出现此错误:

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

我将不胜感激在解决此问题方面的任何帮助。 提前非常感谢你。

在 @ydaetskcoR 的帮助下,我再次查看了代码,并意识到我引用了错误的 AWS 账户。我立即获得了正确的帐户信息和相应的公共托管区域,我的 CI/CD 管道过程顺利完成。

最新更新