-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.tf
133 lines (105 loc) · 5.5 KB
/
main.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/**
* # dns
*
* This module manages the hashicorp/azurerm dns resources.
* For more information see https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs > dns
*
*/
resource "azurerm_dns_zone" "dns_zone" {
for_each = var.dns_zone
name = local.dns_zone[each.key].name == "" ? each.key : local.dns_zone[each.key].name
resource_group_name = local.dns_zone[each.key].resource_group_name
dynamic "soa_record" {
for_each = local.dns_zone[each.key].soa_record == null ? [] : [0]
content {
email = local.dns_zone[each.key].soa_record.email
host_name = local.dns_zone[each.key].soa_record.host_name
expire_time = local.dns_zone[each.key].soa_record.expire_time
minimum_ttl = local.dns_zone[each.key].soa_record.minimum_ttl
refresh_time = local.dns_zone[each.key].soa_record.refresh_time
retry_time = local.dns_zone[each.key].soa_record.retry_time
serial_number = local.dns_zone[each.key].soa_record.serial_number
ttl = local.dns_zone[each.key].soa_record.ttl
tags = local.dns_zone[each.key].soa_record.tags
}
}
tags = local.dns_zone[each.key].tags
}
resource "azurerm_private_dns_zone" "private_dns_zone" {
for_each = var.private_dns_zone
name = local.private_dns_zone[each.key].name == "" ? each.key : local.private_dns_zone[each.key].name
resource_group_name = local.private_dns_zone[each.key].resource_group_name
dynamic "soa_record" {
for_each = local.private_dns_zone[each.key].soa_record == null ? [] : [0]
content {
email = local.private_dns_zone[each.key].soa_record.email
host_name = local.private_dns_zone[each.key].soa_record.host_name
expire_time = local.private_dns_zone[each.key].soa_record.expire_time
minimum_ttl = local.private_dns_zone[each.key].soa_record.minimum_ttl
refresh_time = local.private_dns_zone[each.key].soa_record.refresh_time
retry_time = local.private_dns_zone[each.key].soa_record.retry_time
serial_number = local.private_dns_zone[each.key].soa_record.serial_number
ttl = local.private_dns_zone[each.key].soa_record.ttl
tags = local.private_dns_zone[each.key].soa_record.tags
}
}
tags = local.private_dns_zone[each.key].tags
}
resource "azurerm_dns_a_record" "dns_a_record" {
for_each = var.dns_a_record
name = local.dns_a_record[each.key].name == "" ? each.key : local.dns_a_record[each.key].name
resource_group_name = local.dns_a_record[each.key].resource_group_name
zone_name = local.dns_a_record[each.key].zone_name
ttl = local.dns_a_record[each.key].ttl
records = local.dns_a_record[each.key].records
target_resource_id = local.dns_a_record[each.key].target_resource_id
tags = local.dns_a_record[each.key].tags
}
resource "azurerm_dns_cname_record" "dns_cname_record" {
for_each = var.dns_cname_record
name = local.dns_cname_record[each.key].name == "" ? each.key : local.dns_cname_record[each.key].name
resource_group_name = local.dns_cname_record[each.key].resource_group_name
zone_name = local.dns_cname_record[each.key].zone_name
ttl = local.dns_cname_record[each.key].ttl
record = local.dns_cname_record[each.key].record
target_resource_id = local.dns_cname_record[each.key].target_resource_id
tags = local.dns_cname_record[each.key].tags
}
resource "azurerm_dns_txt_record" "dns_txt_record" {
for_each = var.dns_txt_record
name = local.dns_txt_record[each.key].name == "" ? each.key : local.dns_txt_record[each.key].name
resource_group_name = local.dns_txt_record[each.key].resource_group_name
zone_name = local.dns_txt_record[each.key].zone_name
ttl = local.dns_txt_record[each.key].ttl
dynamic "record" {
for_each = local.dns_txt_record[each.key].record
content {
value = local.dns_txt_record[each.key].record[record.key].value
}
}
tags = local.dns_txt_record[each.key].tags
}
resource "azurerm_dns_mx_record" "dns_mx_record" {
for_each = var.dns_mx_record
name = local.dns_mx_record[each.key].name == "" ? each.key : local.dns_mx_record[each.key].name
resource_group_name = local.dns_mx_record[each.key].resource_group_name
zone_name = local.dns_mx_record[each.key].zone_name
ttl = local.dns_mx_record[each.key].ttl
dynamic "record" {
for_each = local.dns_mx_record[each.key].record
content {
preference = local.dns_mx_record[each.key].record[record.key].preference
exchange = local.dns_mx_record[each.key].record[record.key].exchange
}
}
tags = local.dns_mx_record[each.key].tags
}
resource "azurerm_private_dns_zone_virtual_network_link" "private_dns_zone_virtual_network_link" {
for_each = var.private_dns_zone_virtual_network_link
name = local.private_dns_zone_virtual_network_link[each.key].name == "" ? each.key : local.private_dns_zone_virtual_network_link[each.key].name
resource_group_name = local.private_dns_zone_virtual_network_link[each.key].resource_group_name
private_dns_zone_name = local.private_dns_zone_virtual_network_link[each.key].private_dns_zone_name
virtual_network_id = local.private_dns_zone_virtual_network_link[each.key].virtual_network_id
registration_enabled = local.private_dns_zone_virtual_network_link[each.key].registration_enabled
tags = local.private_dns_zone_virtual_network_link[each.key].tags
}