Error: no matching Route 53 Hosted Zone found
│
│ with data.aws_route53_zone.aws_rke2_zone,
│ on route53.tf line 1, in data "aws_route53_zone" "aws_rke2_zone":
│ 1: data "aws_route53_zone" "aws_rke2_zone" {
│
╵
╷
│ Error: no matching Route 53 Hosted Zone found
│
│ with module.rke2-cluster.data.aws_route53_zone.aws_rke2_zone,
│ on .terraform\modules\rke2-cluster\route53.tf line 1, in data "aws_route53_zone" "aws_rke2_zone":
│ 1: data "aws_route53_zone" "aws_rke2_zone" {
below you can see
route53.tf
..............................
data "aws_route53_zone" "aws_rke2_zone" {
name = var.domain
}
resource "aws_route53_record" "aws_rke2_record_rke2" {
zone_id = data.aws_route53_zone.aws_rke2_zone.zone_id
name = ""
type = "A"
alias {
name = aws_elb.aws_rke2_elb.dns_name
zone_id = aws_elb.aws_rke2_elb.zone_id
evaluate_target_health = false
}
depends_on = [aws_elb.aws_rke2_elb]
}
resource "aws_route53_record" "aws_rke2_record_ingress" {
zone_id = data.aws_route53_zone.aws_rke2_zone.zone_id
name = "*"
type = "A"
alias {
name = aws_elb.aws_rke2_ingress_elb.dns_name
zone_id = aws_elb.aws_rke2_ingress_elb.zone_id
evaluate_target_health = false
}
depends_on = [aws_elb.aws_rke2_ingress_elb]
}
.....................................................................
variable "domain" {
default = "rke2.internal"
type = string
description = "(Required) The AWS Route53 domain to use for the cluster(s)."
..................
.................
................
.....................................................................
I've created private hosted zone rke2.internal and with terraform user i'm able to do the following command:
Hi in terraform plan
we have the error:
Error: no matching Route 53 Hosted Zone found │ │ with data.aws_route53_zone.aws_rke2_zone, │ on route53.tf line 1, in data "aws_route53_zone" "aws_rke2_zone": │ 1: data "aws_route53_zone" "aws_rke2_zone" { │ ╵ ╷ │ Error: no matching Route 53 Hosted Zone found │ │ with module.rke2-cluster.data.aws_route53_zone.aws_rke2_zone, │ on .terraform\modules\rke2-cluster\route53.tf line 1, in data "aws_route53_zone" "aws_rke2_zone": │ 1: data "aws_route53_zone" "aws_rke2_zone" {
below you can see
route53.tf
.............................. data "aws_route53_zone" "aws_rke2_zone" { name = var.domain } resource "aws_route53_record" "aws_rke2_record_rke2" { zone_id = data.aws_route53_zone.aws_rke2_zone.zone_id name = "" type = "A" alias { name = aws_elb.aws_rke2_elb.dns_name zone_id = aws_elb.aws_rke2_elb.zone_id evaluate_target_health = false } depends_on = [aws_elb.aws_rke2_elb] }
resource "aws_route53_record" "aws_rke2_record_ingress" { zone_id = data.aws_route53_zone.aws_rke2_zone.zone_id name = "*" type = "A" alias { name = aws_elb.aws_rke2_ingress_elb.dns_name zone_id = aws_elb.aws_rke2_ingress_elb.zone_id evaluate_target_health = false } depends_on = [aws_elb.aws_rke2_ingress_elb] } .....................................................................
variables.tf ........................................
variable "domain" { default = "rke2.internal" type = string description = "(Required) The AWS Route53 domain to use for the cluster(s)." .................. ................. ................ .....................................................................
I've created private hosted zone rke2.internal and with terraform user i'm able to do the following command:
aws route53 list-hosted-zones-by-name { "HostedZones": [ { "Id": "/hostedzone/Z09559122E6WUXQPDD1M7", "Name": "rke2.internal.", "CallerReference": "eb23bdf3-d3ac-4e7b-8797-a1aa3e3cae44", "Config": { "Comment": "", "PrivateZone": true }, "ResourceRecordSetCount": 2 }
Do you have any suggestion? thank you in advance Alex