-
Notifications
You must be signed in to change notification settings - Fork 0
/
dns.tf
39 lines (32 loc) · 828 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
31
32
33
34
35
36
37
38
39
module "dns" {
source = "dasmeta/dns/aws"
version = "1.0.4"
count = var.zone == null ? 0 : 1
zone = var.zone
create_zone = false
records = [
{
target_type = "cdn"
name = replace(var.domain, var.zone, "")
distribution_id = module.cdn.cloudfront_distribution_id
}
]
}
module "dns_alternative" {
source = "dasmeta/dns/aws"
version = "1.0.4"
for_each = { for key, domain in var.alternative_domains : domain => {
domain : domain
key : key
zone : try(var.alternative_zones[key], var.zone)
} }
zone = each.value.zone
create_zone = false
records = [
{
target_type = "cdn"
name = replace(each.value.domain, each.value.zone, "")
distribution_id = module.cdn.cloudfront_distribution_id
}
]
}