bsmsapp/terraform/modules/route53/main.tf

27 lines
765 B
HCL

# ------------------------------------------------------------------------------
# Amazon Route 53
# ------------------------------------------------------------------------------
data "aws_route53_zone" "this" {
name = var.zone_name
private_zone = var.private_zone
}
resource "aws_route53_record" "this" {
for_each = var.records
zone_id = data.aws_route53_zone.this.zone_id
name = each.value.name
type = each.value.type
dynamic "alias" {
for_each = length(keys(lookup(each.value, "alias", {}))) == 0 ? [] : [true]
content {
name = each.value.alias.name
zone_id = try(each.value.alias.zone_id, data.aws_route53_zone.this.zone_id)
evaluate_target_health = false
}
}
}