forked from tuier/tfm-vpc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dns.tf
40 lines (33 loc) · 1.09 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
resource "aws_route53_record" "bastion" {
#count = "${length(aws_network_interface.bastion.*.private_ips)}"
count = "${var.azs_count}"
name = "bastion-${var.cluster_name}"
zone_id = "${var.route_zone_id}"
type = "A"
set_identifier = "${count.index}"
weighted_routing_policy {
weight = "${count.index}"
}
records = ["${element(aws_eip.bastion.*.public_ip,count.index)}"]
ttl = 60
health_check_id = "${element(aws_route53_health_check.bastion_check.*.id,count.index)}"
}
resource "aws_route53_health_check" "bastion_check" {
count = "${var.azs_count}"
#count = "${length(aws_route53_record.bastion.*.)}"
ip_address = "${element(aws_eip.bastion.*.public_ip,count.index)}"
port = 22
type = "TCP"
failure_threshold = "2"
request_interval = "10"
tags {
Name = "${var.cluster_name}_bastion-check"
cluster = "${var.cluster_name}"
product = "${var.tag_product}"
purpose = "${var.tag_purpose}"
builder = "terraform"
}
lifecycle {
create_before_destroy = true
}
}