Skip to content

Commit 68a56f0

Browse files
committed
fix: use site_prefix in DNS entries
1 parent abc903d commit 68a56f0

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

r53.tf

+15-3
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,30 @@
11
resource "aws_route53_record" "www" {
2+
count = var.site_prefix == "www" ? 0 : 1
23
zone_id = var.hosted_zone_id
3-
name = "www"
4+
name = "www.${var.site_prefix}.${var.site_domain}"
45
type = "CNAME"
56
ttl = "600"
6-
records = [var.site_domain]
7+
records = ["${var.site_prefix}${var.site_prefix == "" ? "" : "."}${var.site_domain}"]
78
}
89

910
resource "aws_route53_record" "apex" {
1011
zone_id = var.hosted_zone_id
11-
name = var.site_domain
12+
name = "${var.site_prefix}${var.site_prefix == "" ? "" : "."}${var.site_domain}"
1213
type = "A"
1314
alias {
1415
name = module.cloudfront.wordpress_cloudfront_distribution_domain_name
1516
zone_id = module.cloudfront.wordpress_cloudfront_distrubtion_hostedzone_id
1617
evaluate_target_health = false
1718
}
1819
}
20+
21+
resource "aws_route53_record" "apex_aaaa" {
22+
zone_id = var.hosted_zone_id
23+
name = "${var.site_prefix}${var.site_prefix == "" ? "" : "."}${var.site_domain}"
24+
type = "AAAA"
25+
alias {
26+
name = module.cloudfront.wordpress_cloudfront_distribution_domain_name
27+
zone_id = module.cloudfront.wordpress_cloudfront_distrubtion_hostedzone_id
28+
evaluate_target_health = false
29+
}
30+
}

0 commit comments

Comments
 (0)