Skip to content

Commit 046c75d

Browse files
authored
refactor(iac): inline Route53 app records (#61)
1 parent 43a183e commit 046c75d

File tree

1 file changed

+29
-31
lines changed

1 file changed

+29
-31
lines changed

iac/main.tf

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -184,40 +184,38 @@ resource "aws_lambda_permission" "allow_cloudfront" {
184184
function_url_auth_type = "AWS_IAM"
185185
}
186186

187-
module "dns_records" {
188-
source = "terraform-aws-modules/route53/aws"
189-
version = "6.1.0"
190-
191-
create = true
192-
create_zone = false
193-
name = data.aws_route53_zone.zone.name
194-
private_zone = false
187+
resource "aws_route53_record" "app_a" {
188+
zone_id = data.aws_route53_zone.zone.zone_id
189+
name = var.app_domain
190+
type = "A"
191+
allow_overwrite = true
192+
193+
alias {
194+
name = module.cdn.cloudfront_distribution_domain_name
195+
zone_id = module.cdn.cloudfront_distribution_hosted_zone_id
196+
evaluate_target_health = false
197+
}
198+
}
195199

196-
records = {
197-
app_a = {
198-
full_name = var.app_domain
199-
type = "A"
200-
allow_overwrite = true
201-
alias = {
202-
name = module.cdn.cloudfront_distribution_domain_name
203-
zone_id = module.cdn.cloudfront_distribution_hosted_zone_id
204-
evaluate_target_health = false
205-
}
206-
}
200+
resource "aws_route53_record" "app_aaaa" {
201+
zone_id = data.aws_route53_zone.zone.zone_id
202+
name = var.app_domain
203+
type = "AAAA"
204+
allow_overwrite = true
207205

208-
app_aaaa = {
209-
full_name = var.app_domain
210-
type = "AAAA"
211-
allow_overwrite = true
212-
alias = {
213-
name = module.cdn.cloudfront_distribution_domain_name
214-
zone_id = module.cdn.cloudfront_distribution_hosted_zone_id
215-
evaluate_target_health = false
216-
}
217-
}
206+
alias {
207+
name = module.cdn.cloudfront_distribution_domain_name
208+
zone_id = module.cdn.cloudfront_distribution_hosted_zone_id
209+
evaluate_target_health = false
218210
}
211+
}
219212

220-
tags = local.default_tags
213+
moved {
214+
from = module.dns_records.aws_route53_record.this["app_a"]
215+
to = aws_route53_record.app_a
216+
}
221217

222-
depends_on = [module.cdn]
218+
moved {
219+
from = module.dns_records.aws_route53_record.this["app_aaaa"]
220+
to = aws_route53_record.app_aaaa
223221
}

0 commit comments

Comments
 (0)