-
Notifications
You must be signed in to change notification settings - Fork 0
/
dns.tf
31 lines (27 loc) · 901 Bytes
/
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
resource "aws_route53_record" "web" {
count = length(var.route53_zone_id) > 0 ? var.web_instance_count : 0
zone_id = var.route53_zone_id
name = aws_instance.web[count.index].tags["Name"]
type = "A"
ttl = 300
records = [aws_eip.web[count.index].public_ip]
}
resource "aws_route53_record" "worker" {
count = length(var.route53_zone_id) > 0 ? var.worker_instance_count : 0
zone_id = var.route53_zone_id
name = aws_instance.worker[count.index].tags["Name"]
type = "A"
ttl = 300
records = [aws_eip.worker[count.index].public_ip]
}
resource "aws_route53_record" "lb" {
count = length(var.route53_zone_id) > 0 ? 1 : 0
zone_id = var.route53_zone_id
name = var.lb_domain_name
type = "A"
alias {
name = aws_lb.production.dns_name
zone_id = aws_lb.production.zone_id
evaluate_target_health = true
}
}