-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathroute53.tf
92 lines (77 loc) · 2.82 KB
/
route53.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
resource "aws_route53_record" "main_website" {
count = var.create_route53_entry ? 1 : 0
zone_id = var.route53_hosted_zone_id
name = var.dns_entry
type = "CNAME"
ttl = "300"
records = [aws_cloudfront_distribution.main_website.domain_name]
}
resource "aws_route53_record" "secondary_website" {
count = var.create_route53_entry ? 1 : 0
zone_id = var.route53_hosted_zone_id
name = var.dns_entry_secondary
type = "CNAME"
ttl = "300"
records = [aws_cloudfront_distribution.secondary_website[count.index].domain_name]
}
# Use for specific domain name registered in on-prem DNS (i.e. for prod env)
# (see https://wiki.auckland.ac.nz/display/ITCB/AWS+Host+S3+Static+Web+Content#CreateDistribution)
# Create route53 hosted zone
# resource "aws_route53_zone" "main" {
# count = var.create_route53_zone ? 1 : 0
# name = var.dns_entry
# }
# # Create IPv4 alias route53 record in hosted zone
# resource "aws_route53_record" "main_website_ipv4" {
# count = var.create_route53_zone ? 1 : 0
# zone_id = aws_route53_zone.main[0].id
# name = var.dns_entry
# type = "A"
# alias {
# name = aws_cloudfront_distribution.main_website.domain_name
# zone_id = aws_cloudfront_distribution.main_website.hosted_zone_id
# evaluate_target_health = false
# }
# }
# # Create IPv6 alias route53 record in hosted zone
# resource "aws_route53_record" "main_website_ipv6" {
# count = var.create_route53_zone ? 1 : 0
# zone_id = aws_route53_zone.main[0].id
# name = var.dns_entry
# type = "AAAA"
# alias {
# name = aws_cloudfront_distribution.main_website.domain_name
# zone_id = aws_cloudfront_distribution.main_website.hosted_zone_id
# evaluate_target_health = false
# }
# }
# # Secondary site
# # Create route53 hosted zone
# resource "aws_route53_zone" "secondary" {
# count = var.create_route53_zone ? 1 : 0
# name = var.dns_entry_secondary
# }
# # Create IPv4 alias route53 record in hosted zone
# resource "aws_route53_record" "secondary_website_ipv4" {
# count = var.create_route53_zone ? 1 : 0
# zone_id = aws_route53_zone.secondary[0].id
# name = var.dns_entry_secondary
# type = "A"
# alias {
# name = aws_cloudfront_distribution.secondary_website[0].domain_name
# zone_id = aws_cloudfront_distribution.secondary_website[0].hosted_zone_id
# evaluate_target_health = false
# }
# }
# # Create IPv6 alias route53 record in hosted zone
# resource "aws_route53_record" "secondary_website_ipv6" {
# count = var.create_route53_zone ? 1 : 0
# zone_id = aws_route53_zone.secondary[0].id
# name = var.dns_entry_secondary
# type = "AAAA"
# alias {
# name = aws_cloudfront_distribution.secondary_website[0].domain_name
# zone_id = aws_cloudfront_distribution.secondary_website[0].hosted_zone_id
# evaluate_target_health = false
# }
# }