From 43d14e226e02375599cf74effde91dea1efa2153 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arturo=20Filast=C3=B2?= Date: Tue, 2 Jul 2024 15:40:33 +0200 Subject: [PATCH] Fix DNS record MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit You can't make an ALIAS record for an EC2 node, since you get this error: │ Error: creating Route 53 Record: InvalidChangeBatch: [Tried to create an alias that targets ec2-3-120-245-80.eu-central-1.compute.amazonaws.com., type A in zone Z04499311AMTU66QF54HY, but the alias target name does not lie within the target zone] --- tf/modules/ansible_controller/main.tf | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tf/modules/ansible_controller/main.tf b/tf/modules/ansible_controller/main.tf index 9d90414b..7cc22aad 100644 --- a/tf/modules/ansible_controller/main.tf +++ b/tf/modules/ansible_controller/main.tf @@ -66,11 +66,10 @@ resource "aws_instance" "ansible_controller" { resource "aws_route53_record" "oonith_service_alias" { zone_id = var.dns_zone_ooni_io name = "ansible-controller" - type = "A" + type = "CNAME" + ttl = 300 - alias { - name = aws_instance.ansible_controller.public_dns - zone_id = var.dns_zone_ooni_io - evaluate_target_health = true - } + records = [ + aws_instance.ansible_controller.public_dns + ] }