-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdns.tf
25 lines (24 loc) · 1.08 KB
/
dns.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
resource "aws_route53_record" "dns" {
count = var.hosted_zone_id != "" && var.service_fqdn != "" ? 1 : 0
zone_id = var.hosted_zone_id
name = var.service_fqdn
type = "A"
alias {
name = var.use_cloudfront ? aws_cloudfront_distribution.distribution[0].domain_name : aws_lb.alb.dns_name
evaluate_target_health = false
zone_id = var.use_cloudfront ? aws_cloudfront_distribution.distribution[0].hosted_zone_id : aws_lb.alb.zone_id
}
allow_overwrite = var.route53_allow_overwrite
}
resource "aws_route53_record" "dns_ipv6" {
count = var.ipv6 && var.hosted_zone_id != "" && var.service_fqdn != "" ? 1 : 0
zone_id = var.hosted_zone_id
name = var.service_fqdn
type = "AAAA"
alias {
name = var.use_cloudfront ? aws_cloudfront_distribution.distribution[0].domain_name : aws_lb.alb.dns_name
evaluate_target_health = false
zone_id = var.use_cloudfront ? aws_cloudfront_distribution.distribution[0].hosted_zone_id : aws_lb.alb.zone_id
}
allow_overwrite = var.route53_allow_overwrite
}