-
Notifications
You must be signed in to change notification settings - Fork 705
/
lb.tf
151 lines (123 loc) · 6.12 KB
/
lb.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
module "lb" {
source = "./modules/networking/lb"
for_each = local.networking.lb
global_settings = local.global_settings
client_config = local.client_config
settings = each.value
location = can(local.global_settings.regions[each.value.region]) ? local.global_settings.regions[each.value.region] : local.combined_objects_resource_groups[try(each.value.resource_group.lz_key, local.client_config.landingzone_key)][try(each.value.resource_group.key, each.value.resource_group_key)].location
resource_group_name = can(each.value.resource_group.name) || can(each.value.resource_group_name) ? try(each.value.resource_group.name, each.value.resource_group_name) : local.combined_objects_resource_groups[try(each.value.resource_group.lz_key, local.client_config.landingzone_key)][try(each.value.resource_group_key, each.value.resource_group.key)].name
remote_objects = {
resource_group = local.combined_objects_resource_groups
virtual_network = local.combined_objects_networking
public_ip_addresses = local.combined_objects_public_ip_addresses
}
}
output "lb" {
value = module.lb
}
module "lb_backend_address_pool" {
source = "./modules/networking/lb_backend_address_pool"
for_each = local.networking.lb_backend_address_pool
global_settings = local.global_settings
client_config = local.client_config
settings = each.value
remote_objects = {
lb = local.combined_objects_lb
}
}
output "lb_backend_address_pool" {
value = module.lb_backend_address_pool
}
module "lb_backend_address_pool_address" {
source = "./modules/networking/lb_backend_address_pool_address"
for_each = local.networking.lb_backend_address_pool_address
global_settings = local.global_settings
client_config = local.client_config
settings = each.value
remote_objects = {
virtual_network = local.combined_objects_networking
lb_backend_address_pool = local.combined_objects_lb_backend_address_pool
}
}
output "lb_backend_address_pool_address" {
value = module.lb_backend_address_pool_address
}
module "lb_nat_pool" {
source = "./modules/networking/lb_nat_pool"
for_each = local.networking.lb_nat_pool
global_settings = local.global_settings
client_config = local.client_config
settings = each.value
resource_group_name = can(each.value.resource_group.name) || can(each.value.resource_group_name) ? try(each.value.resource_group.name, each.value.resource_group_name) : local.combined_objects_resource_groups[try(each.value.resource_group.lz_key, local.client_config.landingzone_key)][try(each.value.resource_group_key, each.value.resource_group.key)].name
remote_objects = {
resource_group = local.combined_objects_resource_groups
lb = local.combined_objects_lb
}
}
output "lb_nat_pool" {
value = module.lb_nat_pool
}
module "lb_nat_rule" {
source = "./modules/networking/lb_nat_rule"
for_each = local.networking.lb_nat_rule
global_settings = local.global_settings
client_config = local.client_config
settings = each.value
resource_group_name = can(each.value.resource_group.name) || can(each.value.resource_group_name) ? try(each.value.resource_group.name, each.value.resource_group_name) : local.combined_objects_resource_groups[try(each.value.resource_group.lz_key, local.client_config.landingzone_key)][try(each.value.resource_group_key, each.value.resource_group.key)].name
remote_objects = {
resource_group = local.combined_objects_resource_groups
lb = local.combined_objects_lb
}
}
output "lb_nat_rule" {
value = module.lb_nat_rule
}
module "lb_outbound_rule" {
source = "./modules/networking/lb_outbound_rule"
for_each = local.networking.lb_outbound_rule
global_settings = local.global_settings
client_config = local.client_config
settings = each.value
resource_group_name = can(each.value.resource_group.name) || can(each.value.resource_group_name) ? try(each.value.resource_group.name, each.value.resource_group_name) : local.combined_objects_resource_groups[try(each.value.resource_group.lz_key, local.client_config.landingzone_key)][try(each.value.resource_group_key, each.value.resource_group.key)].name
remote_objects = {
resource_group = local.combined_objects_resource_groups
lb = local.combined_objects_lb
lb_backend_address_pool = local.combined_objects_lb_backend_address_pool
}
}
output "lb_outbound_rule" {
value = module.lb_outbound_rule
}
module "lb_probe" {
source = "./modules/networking/lb_probe"
for_each = local.networking.lb_probe
global_settings = local.global_settings
client_config = local.client_config
settings = each.value
remote_objects = {
resource_group = local.combined_objects_resource_groups
lb = local.combined_objects_lb
}
}
output "lb_probe" {
value = module.lb_probe
}
module "lb_rule" {
source = "./modules/networking/lb_rule"
for_each = local.networking.lb_rule
global_settings = local.global_settings
client_config = local.client_config
settings = each.value
resource_group_name = can(each.value.resource_group.name) || can(each.value.resource_group_name) ? try(each.value.resource_group.name, each.value.resource_group_name) : local.combined_objects_resource_groups[try(each.value.resource_group.lz_key, local.client_config.landingzone_key)][try(each.value.resource_group_key, each.value.resource_group.key)].name
backend_address_pool_ids = can(each.value.backend_address_pool_ids) || can(each.value.backend_address_pool) == false ? try(each.value.backend_address_pool_ids, null) : [
for k, v in each.value.backend_address_pool : local.combined_objects_lb_backend_address_pool[try(v.lz_key, local.client_config.landingzone_key)][v.key].id
]
probe_id = can(each.value.probe_id) || can(each.value.probe.key) == false ? try(each.value.probe_id, null) : local.combined_objects_lb_probe[try(each.value.probe.lz_key, local.client_config.landingzone_key)][each.value.probe.key].id
remote_objects = {
resource_group = local.combined_objects_resource_groups
lb = local.combined_objects_lb
}
}
output "lb_rule" {
value = module.lb_rule
}