From 733a6eb34c1e845fe27d40c60da651f96eef1017 Mon Sep 17 00:00:00 2001 From: "Justin A. Timmers" <64535545+JATimmers@users.noreply.github.com> Date: Wed, 7 Jun 2023 19:19:40 +0200 Subject: [PATCH] Added Route 53 AAAA records when var.is_ipv6_enabled is true (#61) Co-authored-by: Justin A. Timmers --- website.tf | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/website.tf b/website.tf index ccd0ef6..094e403 100644 --- a/website.tf +++ b/website.tf @@ -246,6 +246,22 @@ resource "aws_route53_record" "website_cloudfront_record" { } } +resource "aws_route53_record" "website_cloudfront_record_ipv6" { + provider = aws.main + + count = (var.is_ipv6_enabled && var.create_route53_website_records) ? 1 : 0 + + zone_id = var.create_route53_hosted_zone ? aws_route53_zone.hosted_zone[0].zone_id : var.route53_hosted_zone_id + name = local.website_bucket_name + type = "AAAA" + + alias { + name = aws_cloudfront_distribution.website.domain_name + zone_id = aws_cloudfront_distribution.website.hosted_zone_id + evaluate_target_health = false + } +} + resource "aws_route53_record" "www_website_record" { provider = aws.main @@ -261,3 +277,19 @@ resource "aws_route53_record" "www_website_record" { evaluate_target_health = false } } + +resource "aws_route53_record" "www_website_record_ipv6" { + provider = aws.main + + count = (var.is_ipv6_enabled && var.www_website_redirect_enabled && var.create_route53_website_records) ? 1 : 0 + + zone_id = var.create_route53_hosted_zone ? aws_route53_zone.hosted_zone[0].zone_id : var.route53_hosted_zone_id + name = local.www_website_bucket_name + type = "AAAA" + + alias { + name = aws_cloudfront_distribution.website.domain_name + zone_id = aws_cloudfront_distribution.website.hosted_zone_id + evaluate_target_health = false + } +}