-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathroute53.tf
57 lines (50 loc) · 1.41 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
####################################
# ROUTE 53 HEALTH CHECK
####################################
resource "aws_route53_health_check" "tf-health" {
type = "HTTP"
port = 80
fqdn = aws_cloudfront_distribution.cf-tf.domain_name
request_interval = 30
tags = {
Name = "${var.s3-failover}-healthcheck"
}
}
###################################
## ROUTE 53 AND HOSTED ZONE
###################################
resource "aws_route53_record" "primary" {
zone_id = data.aws_route53_zone.zone.zone_id
name = "capstone"
type = "A"
set_identifier = "primary"
health_check_id = aws_route53_health_check.tf-health.id
depends_on = [
aws_cloudfront_distribution.cf-tf
]
alias {
name = aws_cloudfront_distribution.cf-tf.domain_name
zone_id = "Z2FDTNDATAQYW2"
evaluate_target_health = false
}
failover_routing_policy {
type = "PRIMARY"
}
}
resource "aws_route53_record" "secondary" {
zone_id = data.aws_route53_zone.zone.zone_id
name = "capstone"
set_identifier = "Secondary"
type = "A"
depends_on = [
aws_cloudfront_distribution.cf-tf
]
alias {
name = "s3-website-us-east-1.amazonaws.com"
zone_id = "Z3AQBSTGFYJSTF"
evaluate_target_health = true
}
failover_routing_policy {
type = "SECONDARY"
}
}