forked from techservicesillinois/terraform-aws-ecs-service
-
Notifications
You must be signed in to change notification settings - Fork 1
/
route53.tf
25 lines (20 loc) · 780 Bytes
/
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
data "aws_route53_zone" "selected" {
count = length(var.alias) > 0 && length(var.load_balancer) > 0 ? 1 : 0
name = local.alias_domain
vpc_id = local.internal_lb == true ? local.lb_vpc_id : ""
private_zone = local.internal_lb
}
locals {
internal_lb = element(concat(data.aws_lb.selected.*.internal, [""]), 0)
}
resource "aws_route53_record" "default" {
count = length(var.alias) > 0 && length(var.load_balancer) > 0 ? 1 : 0
zone_id = data.aws_route53_zone.selected[0].zone_id
name = local.alias_hostname
type = "A"
alias {
name = element(concat(data.aws_lb.selected.*.dns_name, [""]), 0)
zone_id = element(concat(data.aws_lb.selected.*.zone_id, [""]), 0)
evaluate_target_health = true
}
}