-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathvariables.tf
425 lines (422 loc) · 17.8 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
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
variable "virtual_network" {
type = any
default = {}
description = "Resource definition, default settings are defined within locals and merged with var settings. For more information look at [Outputs](#Outputs)."
}
variable "subnet" {
type = any
default = {}
description = "Resource definition, default settings are defined within locals and merged with var settings. For more information look at [Outputs](#Outputs)."
}
variable "public_ip" {
type = any
default = {}
description = "Resource definition, default settings are defined within locals and merged with var settings. For more information look at [Outputs](#Outputs)."
}
variable "network_interface" {
type = any
default = {}
description = "Resource definition, default settings are defined within locals and merged with var settings. For more information look at [Outputs](#Outputs)."
}
variable "network_security_group" {
type = any
default = {}
description = "Resource definition, default settings are defined within locals and merged with var settings. For more information look at [Outputs](#Outputs)."
}
variable "subnet_network_security_group_association" {
type = any
default = {}
description = "Resource definition, default settings are defined within locals and merged with var settings. For more information look at [Outputs](#Outputs)."
}
variable "network_interface_security_group_association" {
type = any
default = {}
description = "Resource definition, default settings are defined within locals and merged with var settings. For more information look at [Outputs](#Outputs)."
}
variable "local_network_gateway" {
type = any
default = {}
description = "Resource definition, default settings are defined within locals and merged with var settings. For more information look at [Outputs](#Outputs)."
}
variable "virtual_network_gateway" {
type = any
default = {}
description = "Resource definition, default settings are defined within locals and merged with var settings. For more information look at [Outputs](#Outputs)."
}
variable "private_endpoint" {
type = any
default = {}
description = "Resource definition, default settings are defined within locals and merged with var settings. For more information look at [Outputs](#Outputs)."
}
variable "virtual_network_gateway_connection" {
type = any
default = {}
description = "Resource definition, default settings are defined within locals and merged with var settings. For more information look at [Outputs](#Outputs)."
}
variable "virtual_network_peering" {
type = any
default = {}
description = "Resource definition, default settings are defined within locals and merged with var settings. For more information look at [Outputs](#Outputs)."
}
locals {
default = {
// resource definition
virtual_network = {
name = ""
bgp_community = null
dns_servers = null
edge_zone = null
flow_timeout_in_minutes = null
ddos_protection_plan = {}
subnet = {
name = ""
security_group = null
}
tags = {}
}
subnet = {
name = ""
private_endpoint_network_policies_enabled = null
private_link_service_network_policies_enabled = null
service_endpoints = null
service_endpoint_policy_ids = null
delegation = {
name = ""
service_delegation = {
name = ""
actions = null
}
}
}
public_ip = {
name = ""
allocation_method = "Dynamic"
zones = null
ddos_protection_mode = null
ddos_protection_plan_id = null
domain_name_label = null
edge_zone = null
idle_timeout_in_minutes = null
ip_tags = null
ip_version = "IPv4"
public_ip_prefix_id = null
reverse_fqdn = null
sku = null
sku_tier = null
tags = {}
}
network_interface = {
name = ""
dns_servers = null
edge_zone = null
enable_ip_forwarding = null
enable_accelerated_networking = null
internal_dns_name_label = null
ip_configuration = {
name = ""
gateway_load_balancer_frontend_ip_configuration_id = null
subnet_id = null
private_ip_address = null
private_ip_address_version = null
private_ip_address_allocation = "Static"
public_ip_address_id = null
primary = null
}
tags = {}
}
network_security_group = {
name = ""
security_rule = {
name = ""
description = null
protocol = "*"
source_port_range = "*"
source_port_ranges = null
destination_port_range = "*"
destination_port_ranges = null
source_address_prefix = "*"
source_address_prefixes = null
source_application_security_group_ids = null
destination_address_prefix = "*"
destination_address_prefixes = null
destination_application_security_group_ids = null
access = "Deny"
direction = "Inbound"
}
tags = {}
}
subnet_network_security_group_association = {}
network_interface_security_group_association = {}
local_network_gateway = {
name = ""
address_space = null
gateway_address = null
gateway_fqdn = null
bgp_settings = {
peer_weight = null
}
tags = {}
}
virtual_network_gateway = {
name = ""
sku = "Basic"
type = "Vpn"
active_active = null
default_local_network_gateway_id = null
edge_zone = null
enable_bgp = null
generation = null
private_ip_address_enabled = null
vpn_type = null
ip_configuration = {
name = ""
private_ip_address_allocation = null
}
bgp_settings = {
asn = null
peer_weight = null
peering_addresses = {
ip_configuration_name = null
apipa_addresses = null
}
}
custom_route = {
address_prefixes = null
}
vpn_client_configuration = {
address_space = ""
aad_tenant = null
aad_audience = null
aad_issuer = null
radius_server_address = null
radius_server_secret = null
vpn_client_protocols = null
vpn_auth_types = null
root_certificate = {}
revoked_certificate = {}
}
tags = {}
}
private_endpoint = {
name = ""
custom_network_interface_name = null
private_dns_zone_group = {}
private_service_connection = {
name = ""
is_manual_connection = true
private_connection_resource_id = null
private_connection_resource_alias = null
subresource_names = null
request_message = "private_endpoint request"
}
ip_configuration = {
name = ""
subresource_name = null
member_name = null
}
tags = {}
}
virtual_network_gateway_connection = {
name = ""
authorization_key = null
dpd_timeout_seconds = null
express_route_circuit_id = null
peer_virtual_network_gateway_id = null
local_azure_ip_address_enabled = null
local_network_gateway_id = null
routing_weight = null
shared_key = null
connection_mode = null
connection_protocol = null
enable_bgp = null
express_route_gateway_bypass = null
egress_nat_rule_ids = null
ingress_nat_rule_ids = null
use_policy_based_traffic_selectors = null
custom_bgp_addresses = {}
ipsec_policy = {
sa_datasize = null
sa_lifetime = null
}
traffic_selector_policy = {}
tags = {}
}
virtual_network_peering = {
name = ""
allow_virtual_network_access = null
allow_forwarded_traffic = null
allow_gateway_transit = null
use_remote_gateways = null
triggers = null
}
}
// compare and merge custom and default values
virtual_network_values = {
for virtual_network in keys(var.virtual_network) :
virtual_network => merge(local.default.virtual_network, var.virtual_network[virtual_network])
}
subnet_values = {
for subnet in keys(var.subnet) :
subnet => merge(local.default.subnet, var.subnet[subnet])
}
network_interface_values = {
for network_interface in keys(var.network_interface) :
network_interface => merge(local.default.network_interface, var.network_interface[network_interface])
}
network_security_group_values = {
for network_security_group in keys(var.network_security_group) :
network_security_group => merge(local.default.network_security_group, var.network_security_group[network_security_group])
}
local_network_gateway_values = {
for local_network_gateway in keys(var.local_network_gateway) :
local_network_gateway => merge(local.default.local_network_gateway, var.local_network_gateway[local_network_gateway])
}
virtual_network_gateway_values = {
for virtual_network_gateway in keys(var.virtual_network_gateway) :
virtual_network_gateway => merge(local.default.virtual_network_gateway, var.virtual_network_gateway[virtual_network_gateway])
}
private_endpoint_values = {
for private_endpoint in keys(var.private_endpoint) :
private_endpoint => merge(local.default.private_endpoint, var.private_endpoint[private_endpoint])
}
virtual_network_gateway_connection_values = {
for virtual_network_gateway_connection in keys(var.virtual_network_gateway_connection) :
virtual_network_gateway_connection => merge(local.default.virtual_network_gateway_connection, var.virtual_network_gateway_connection[virtual_network_gateway_connection])
}
// deep merge of all custom and default values
virtual_network = {
for virtual_network in keys(var.virtual_network) :
virtual_network => merge(
local.virtual_network_values[virtual_network],
{
for config in ["subnet"] :
config => keys(local.virtual_network_values[virtual_network][config]) == keys(local.default.virtual_network[config]) ? {} : {
for key in keys(local.virtual_network_values[virtual_network][config]) :
key => merge(local.default.virtual_network[config], local.virtual_network_values[virtual_network][config][key])
}
}
)
}
subnet = {
for subnet in keys(var.subnet) :
subnet => merge(
local.subnet_values[subnet],
{
for config in ["delegation"] :
config => keys(local.subnet_values[subnet][config]) == keys(local.default.subnet[config]) ? {} : {
for key in keys(local.subnet_values[subnet][config]) :
key => merge(
merge(local.default.subnet[config], local.subnet_values[subnet][config][key]),
{
for subconfig in ["service_delegation"] :
subconfig => merge(local.default.subnet[config][subconfig], local.subnet_values[subnet][config][key][subconfig])
}
)
}
}
)
}
public_ip = {
for public_ip in keys(var.public_ip) :
public_ip => merge(local.default.public_ip, var.public_ip[public_ip])
}
network_interface = {
for network_interface in keys(var.network_interface) :
network_interface => merge(
local.network_interface_values[network_interface],
{
for config in ["ip_configuration"] :
config => keys(local.network_interface_values[network_interface][config]) == keys(local.default.network_interface[config]) ? {} : {
for key in keys(local.network_interface_values[network_interface][config]) :
key => merge(local.default.network_interface[config], local.network_interface_values[network_interface][config][key])
}
}
)
}
network_security_group = {
for network_security_group in keys(var.network_security_group) :
network_security_group => merge(
local.network_security_group_values[network_security_group],
{
for config in ["security_rule"] :
config => {
for key in keys(local.network_security_group_values[network_security_group][config]) :
key => merge(local.default.network_security_group[config], local.network_security_group_values[network_security_group][config][key])
}
}
)
}
subnet_network_security_group_association = {
for subnet_network_security_group_association in keys(var.subnet_network_security_group_association) :
subnet_network_security_group_association => merge(local.default.subnet_network_security_group_association, var.subnet_network_security_group_association[subnet_network_security_group_association])
}
network_interface_security_group_association = {
for network_interface_security_group_association in keys(var.network_interface_security_group_association) :
network_interface_security_group_association => merge(local.default.network_interface_security_group_association, var.network_interface_security_group_association[network_interface_security_group_association])
}
local_network_gateway = {
for local_network_gateway in keys(var.local_network_gateway) :
local_network_gateway => merge(
local.local_network_gateway_values[local_network_gateway],
{
for config in ["bgp_settings"] :
config => merge(local.default.local_network_gateway[config], local.local_network_gateway_values[local_network_gateway][config])
}
)
}
virtual_network_gateway = {
for virtual_network_gateway in keys(var.virtual_network_gateway) :
virtual_network_gateway => merge(
local.virtual_network_gateway_values[virtual_network_gateway],
{
for config in ["bgp_settings", "custom_route", "vpn_client_configuration"] :
config => merge(local.default.virtual_network_gateway[config], local.virtual_network_gateway_values[virtual_network_gateway][config])
},
{
for config in ["ip_configuration"] :
config => {
for key in keys(local.virtual_network_gateway_values[virtual_network_gateway][config]) :
key => merge(local.default.virtual_network_gateway[config], local.virtual_network_gateway_values[virtual_network_gateway][config][key])
}
}
)
}
private_endpoint = {
for private_endpoint in keys(var.private_endpoint) :
private_endpoint => merge(
local.private_endpoint_values[private_endpoint],
{
for config in ["private_dns_zone_group", "private_service_connection"] :
config => merge(local.default.private_endpoint[config], local.private_endpoint_values[private_endpoint][config])
},
{
for config in ["ip_configuration"] :
config => keys(local.private_endpoint_values[private_endpoint][config]) == keys(local.default.private_endpoint[config]) ? {} : {
for key in keys(local.private_endpoint_values[private_endpoint][config]) :
key => merge(local.default.private_endpoint[config], local.private_endpoint_values[private_endpoint][config][key])
}
}
)
}
virtual_network_gateway_connection = {
for virtual_network_gateway_connection in keys(var.virtual_network_gateway_connection) :
virtual_network_gateway_connection => merge(
local.virtual_network_gateway_connection_values[virtual_network_gateway_connection],
{
for config in ["custom_bgp_addresses", "ipsec_policy"] :
config => merge(local.default.virtual_network_gateway_connection[config], local.virtual_network_gateway_connection_values[virtual_network_gateway_connection][config])
},
{
for config in ["traffic_selector_policy"] :
config => keys(local.virtual_network_gateway_connection_values[virtual_network_gateway_connection][config]) == keys(local.default.virtual_network_gateway_connection[config]) ? {} : {
for key in keys(local.virtual_network_gateway_connection_values[virtual_network_gateway_connection][config]) :
key => merge(local.default.virtual_network_gateway_connection[config], local.virtual_network_gateway_connection_values[virtual_network_gateway_connection][config][key])
}
}
)
}
virtual_network_peering = {
for virtual_network_peering in keys(var.virtual_network_peering) :
virtual_network_peering => merge(local.default.virtual_network_peering, var.virtual_network_peering[virtual_network_peering])
}
}