-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdns.tf
19 lines (16 loc) · 1.32 KB
/
dns.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
resource "aws_route53_record" "main_private" {
count = length(var.dns_records_internal_hosted_zone) > 0 ? length(var.dns_records_internal_hosted_zone) : 0
zone_id = lookup(element(var.dns_records_internal_hosted_zone, count.index), "zone_id", null)
name = lookup(element(var.dns_records_internal_hosted_zone, count.index), "name", null)
type = lookup(element(var.dns_records_internal_hosted_zone, count.index), "type", "A")
ttl = lookup(element(var.dns_records_internal_hosted_zone, count.index), "ttl", 3600)
records = lookup(element(var.dns_records_internal_hosted_zone, count.index), "records", [aws_instance.main.private_ip])
}
resource "aws_route53_record" "main_public" {
count = length(var.dns_records_public_hosted_zone) > 0 && var.associate_public_ip_address == true ? length(var.dns_records_public_hosted_zone) : 0
zone_id = lookup(element(var.dns_records_public_hosted_zone, count.index), "zone_id", null)
name = lookup(element(var.dns_records_public_hosted_zone, count.index), "name", null)
type = lookup(element(var.dns_records_public_hosted_zone, count.index), "type", "A")
ttl = lookup(element(var.dns_records_public_hosted_zone, count.index), "ttl", 3600)
records = lookup(element(var.dns_records_public_hosted_zone, count.index), "records", [aws_eip.this.*.public_ip[count.index]])
}