Skip to content

Commit

Permalink
EHD-1057: Simplify hosting: Terraform: DNS record
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesgriff committed Jan 22, 2025
1 parent 077cc1a commit bdb9d5d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions terraform/route53.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,17 @@
data "aws_route53_zone" "route_53_zone_for_our_domain" {
name = "gender-pay-gap.service.gov.uk."
}

resource "aws_route53_record" "dns_alias_record" {
count = var.create_dns_record ? 1 : 0 // Only create this DNS record if "var.create_dns_record" is true

zone_id = data.aws_route53_zone.route_53_zone_for_our_domain.zone_id
name = "${var.dns_record_subdomain_including_dot}${data.aws_route53_zone.route_53_zone_for_our_domain.name}"
type = "A"

alias {
evaluate_target_health = false
name = aws_cloudfront_distribution.distribution.domain_name
zone_id = aws_cloudfront_distribution.distribution.hosted_zone_id
}
}

0 comments on commit bdb9d5d

Please sign in to comment.