forked from telekom-mms/terraform-azurerm-dns
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvariables.tf
106 lines (104 loc) · 3.1 KB
/
variables.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
variable "dns_zone" {
type = any
default = {}
description = "resource definition, default settings are defined within locals and merged with var settings"
}
variable "private_dns_zone" {
type = any
default = {}
description = "resource definition, default settings are defined within locals and merged with var settings"
}
variable "dns_a_record" {
type = any
default = {}
description = "resource definition, default settings are defined within locals and merged with var settings"
}
variable "dns_cname_record" {
type = any
default = {}
description = "resource definition, default settings are defined within locals and merged with var settings"
}
variable "dns_txt_record" {
type = any
default = {}
description = "resource definition, default settings are defined within locals and merged with var settings"
}
variable "dns_mx_record" {
type = any
default = {}
description = "resource definition, default settings are defined within locals and merged with var settings"
}
locals {
default = {
# resource definition
dns_zone = {
name = ""
tags = {}
}
private_dns_zone = {
name = ""
tags = {}
}
dns_a_record = {
name = ""
ttl = "900"
records = null
target_resource_id = null
tags = {}
}
dns_cname_record = {
name = ""
ttl = "900"
record = ""
tags = {}
}
dns_txt_record = {
name = ""
ttl = "900"
records = {}
tags = {}
}
dns_mx_record = {
name = ""
ttl = "900"
records = {}
tags = {}
}
}
# compare and merge custom and default values
dns_txt_record_values = {
for dns_txt_record in keys(var.dns_txt_record) :
dns_txt_record => merge(local.default.dns_txt_record, var.dns_txt_record[dns_txt_record])
}
# merge all custom and default values
dns_zone = {
for dns_zone in keys(var.dns_zone) :
dns_zone => merge(local.default.dns_zone, var.dns_zone[dns_zone])
}
private_dns_zone = {
for private_dns_zone in keys(var.private_dns_zone) :
private_dns_zone => merge(local.default.private_dns_zone, var.private_dns_zone[private_dns_zone])
}
dns_a_record = {
for dns_a_record in keys(var.dns_a_record) :
dns_a_record => merge(local.default.dns_a_record, var.dns_a_record[dns_a_record])
}
dns_cname_record = {
for dns_cname_record in keys(var.dns_cname_record) :
dns_cname_record => merge(local.default.dns_cname_record, var.dns_cname_record[dns_cname_record])
}
dns_txt_record = {
for dns_txt_record in keys(var.dns_txt_record) :
dns_txt_record => merge(
local.dns_txt_record_values[dns_txt_record],
{
for config in ["records"] :
config => merge(local.default.dns_txt_record[config], local.dns_txt_record_values[dns_txt_record][config])
}
)
}
dns_mx_record = {
for dns_mx_record in keys(var.dns_mx_record) :
dns_mx_record => merge(local.default.dns_mx_record, var.dns_mx_record[dns_mx_record])
}
}