-
Notifications
You must be signed in to change notification settings - Fork 5
/
dns.tf
65 lines (56 loc) · 1.93 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
resource "aws_route53_zone" "zone" {
name = "${var.root_domain}"
}
// Workaround to get lower NS ttl for root domain
resource "aws_route53_record" "ns" {
zone_id = "${aws_route53_zone.zone.zone_id}"
name = "${var.root_domain}"
type = "NS"
ttl = "86400"
records = [
"${aws_route53_zone.zone.name_servers.0}",
"${aws_route53_zone.zone.name_servers.1}",
"${aws_route53_zone.zone.name_servers.2}",
"${aws_route53_zone.zone.name_servers.3}",
]
}
resource "aws_route53_record" "www" {
zone_id = "${aws_route53_zone.zone.zone_id}"
name = "${var.www_domain}"
type = "A"
alias = {
name = "${aws_cloudfront_distribution.www_distribution.domain_name}"
zone_id = "${aws_cloudfront_distribution.www_distribution.hosted_zone_id}"
evaluate_target_health = false
}
}
resource "aws_route53_record" "non-www" {
zone_id = "${aws_route53_zone.zone.zone_id}"
name = ""
type = "A"
alias = {
name = "${aws_cloudfront_distribution.non-www_distribution.domain_name}"
zone_id = "${aws_cloudfront_distribution.non-www_distribution.hosted_zone_id}"
evaluate_target_health = false
}
}
resource "aws_route53_record" "www-ipv6" {
zone_id = "${aws_route53_zone.zone.zone_id}"
name = "${var.www_domain}"
type = "AAAA"
alias = {
name = "${aws_cloudfront_distribution.www_distribution.domain_name}"
zone_id = "${aws_cloudfront_distribution.www_distribution.hosted_zone_id}"
evaluate_target_health = false
}
}
resource "aws_route53_record" "non-www-ipv6" {
zone_id = "${aws_route53_zone.zone.zone_id}"
name = ""
type = "AAAA"
alias = {
name = "${aws_cloudfront_distribution.non-www_distribution.domain_name}"
zone_id = "${aws_cloudfront_distribution.non-www_distribution.hosted_zone_id}"
evaluate_target_health = false
}
}