Я использую terraform 0.12 и пытаюсь настроить конечную точку vp c для другого VP C. Когда я пытаюсь настроить запись псевдонима маршрута 53, я всегда получаю сообщение об ошибке, указывающее, что dns_entry - пустой список. Я что-то упускаю здесь очевидное. Если после этого я повторно выполню команду apply, она заполнит запись DNS без проблем.
resource "aws_vpc_endpoint" "endpoint" {
vpc_id = "${local.vpc_id}"
service_name = "${var.service_endpoint}"
vpc_endpoint_type = "Interface"
security_group_ids = [
"${aws_security_group.privatelink.id}",
]
}
resource "aws_vpc_endpoint_subnet_association" "tk-subnet-assc" {
count = (var.endpoint_subnet_count)
vpc_endpoint_id = "${aws_vpc_endpoint.endpoint.id}"
subnet_id = "${local.vpc_private_subnets[count.index]}"
}
resource "aws_route53_zone" "hz" {
name = "${var.privatelink_dns_zone}"
force_destroy = true
vpc {
vpc_id = "${local.vpc_id}"
}
}
resource "aws_route53_record" "tk" {
zone_id = "${aws_route53_zone.hz.zone_id}"
name = "${var.privatelink_dns_name}.${var.privatelink_dns_zone}"
type = "CNAME"
ttl = "300"
records = ["${lookup(aws_vpc_endpoint.endpoint.dns_entry[0], "dns_name")}"]
}
Ошибка: неверный индекс
on main.tf line 55, in resource "aws_route53_record" "tk":
55: records = ["${lookup(aws_vpc_endpoint.endpoint.dns_entry[0], "dns_name")}"]
|----------------
| aws_vpc_endpoint.endpoint.dns_entry is empty list of object
The given key does not identify an element in this collection value.