Skip to content

Commit

Permalink
fix: use site_prefix in DNS entries
Browse files Browse the repository at this point in the history
  • Loading branch information
blimmer committed May 15, 2022
1 parent abc903d commit 2fbcb82
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions r53.tf
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
resource "aws_route53_record" "www" {
count = var.site_prefix == "www" ? 0 : 1
zone_id = var.hosted_zone_id
name = "www"
name = "www.${var.site_prefix}.${var.site_domain}"
type = "CNAME"
ttl = "600"
records = [var.site_domain]
}

resource "aws_route53_record" "apex" {
zone_id = var.hosted_zone_id
name = var.site_domain
name = "${var.site_prefix}${var.site_prefix == "" ? "" : "."}${var.site_domain}"
type = "A"
alias {
name = module.cloudfront.wordpress_cloudfront_distribution_domain_name
zone_id = module.cloudfront.wordpress_cloudfront_distrubtion_hostedzone_id
evaluate_target_health = false
}
}

resource "aws_route53_record" "apex_aaaa" {
zone_id = var.hosted_zone_id
name = "${var.site_prefix}${var.site_prefix == "" ? "" : "."}${var.site_domain}"
type = "AAAA"
alias {
name = module.cloudfront.wordpress_cloudfront_distribution_domain_name
zone_id = module.cloudfront.wordpress_cloudfront_distrubtion_hostedzone_id
evaluate_target_health = false
}
}

0 comments on commit 2fbcb82

Please sign in to comment.