-
Notifications
You must be signed in to change notification settings - Fork 703
/
api_management.tf
366 lines (299 loc) · 19 KB
/
api_management.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
module "api_management" {
source = "./modules/apim/api_management"
for_each = local.apim.api_management
global_settings = local.global_settings
client_config = local.client_config
settings = each.value
vnets = local.combined_objects_networking
public_ip_addresses = local.combined_objects_public_ip_addresses
base_tags = local.global_settings.inherit_tags
resource_group = 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)]
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) : null
location = try(local.global_settings.regions[each.value.region], null)
remote_objects = {
resource_group = local.combined_objects_resource_groups
managed_identities = local.combined_objects_managed_identities
}
}
output "api_management" {
value = module.api_management
}
module "api_management_api" {
source = "./modules/apim/api_management_api"
for_each = local.apim.api_management_api
global_settings = local.global_settings
client_config = local.client_config
settings = each.value
api_management_name = can(each.value.api_management.name) ? each.value.api_management.name : local.combined_objects_api_management[try(each.value.api_management.lz_key, local.client_config.landingzone_key)][each.value.api_management.key].name
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 = {
api_management = local.combined_objects_api_management
resource_group = local.combined_objects_resource_groups
}
}
output "api_management_api" {
value = module.api_management_api
}
module "api_management_logger" {
source = "./modules/apim/api_management_logger"
for_each = local.apim.api_management_logger
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
api_management_name = can(each.value.api_management.name) ? each.value.api_management.name : local.combined_objects_api_management[try(each.value.api_management.lz_key, local.client_config.landingzone_key)][each.value.api_management.key].name
remote_objects = {
resource_group = local.combined_objects_resource_groups
api_management = local.combined_objects_api_management
application_insights = local.combined_objects_application_insights
}
}
output "api_management_logger" {
value = module.api_management_logger
}
module "api_management_api_diagnostic" {
source = "./modules/apim/api_management_api_diagnostic"
for_each = local.apim.api_management_api_diagnostic
global_settings = local.global_settings
client_config = local.client_config
settings = each.value
api_management_logger_id = can(each.value.api_management_logger.id) ? each.value.api_management_logger.id : local.combined_objects_api_management_logger[try(each.value.api_management_logger.lz_key, local.client_config.landingzone_key)][each.value.api_management_logger.key].id
api_management_name = can(each.value.api_management.name) ? each.value.api_management.name : local.combined_objects_api_management[try(each.value.api_management.lz_key, local.client_config.landingzone_key)][each.value.api_management.key].name
resource_group_name = can(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
api_name = can(each.value.api.name) ? each.value.api.name : local.combined_objects_api_management_api[try(each.value.api.lz_key, local.client_config.landingzone_key)][each.value.api.key].name
remote_objects = {
#api_management_logger = local.combined_objects_api_management_logger
#api_management = local.combined_objects_api_management
#resource_group = local.combined_objects_resource_groups
}
}
output "api_management_api_diagnostic" {
value = module.api_management_api_diagnostic
}
module "api_management_api_operation" {
source = "./modules/apim/api_management_api_operation"
for_each = local.apim.api_management_api_operation
global_settings = local.global_settings
client_config = local.client_config
settings = each.value
api_name = can(each.value.api.name) ? each.value.api.name : local.combined_objects_api_management_api[try(each.value.api.lz_key, local.client_config.landingzone_key)][each.value.api.key].name
api_management_name = can(each.value.api_management.name) ? each.value.api_management.name : local.combined_objects_api_management[try(each.value.api_management.lz_key, local.client_config.landingzone_key)][each.value.api_management.key].name
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 = {
api_management = local.combined_objects_api_management
resource_group = local.combined_objects_resource_groups
}
}
output "api_management_api_operation" {
value = module.api_management_api_operation
}
module "api_management_backend" {
source = "./modules/apim/api_management_backend"
for_each = local.apim.api_management_backend
global_settings = local.global_settings
client_config = local.client_config
settings = each.value
api_management_name = can(each.value.api_management.name) ? each.value.api_management.name : local.combined_objects_api_management[try(each.value.api_management.lz_key, local.client_config.landingzone_key)][each.value.api_management.key].name
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 = {
api_management = local.combined_objects_api_management
resource_group = local.combined_objects_resource_groups
}
}
output "api_management_backend" {
value = module.api_management_backend
}
module "api_management_api_policy" {
source = "./modules/apim/api_management_api_policy"
for_each = local.apim.api_management_api_policy
global_settings = local.global_settings
client_config = local.client_config
settings = each.value
api_name = can(each.value.api.name) ? each.value.api.name : local.combined_objects_api_management_api[try(each.value.api.lz_key, local.client_config.landingzone_key)][each.value.api.key].name
api_management_name = can(each.value.api_management.name) ? each.value.api_management.name : local.combined_objects_api_management[try(each.value.api_management.lz_key, local.client_config.landingzone_key)][each.value.api_management.key].name
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 = {
api_management = local.combined_objects_api_management
resource_group = local.combined_objects_resource_groups
}
}
output "api_management_api_policy" {
value = module.api_management_api_policy
}
module "api_management_api_operation_tag" {
source = "./modules/apim/api_management_api_operation_tag"
for_each = local.apim.api_management_api_operation_tag
api_operation_id = can(each.value.api_operation.id) ? each.value.api_operation.id : local.combined_objects_api_management_api_operation[try(each.value.api_operation.lz_key, local.client_config.landingzone_key)][each.value.api_operation.key].id
global_settings = local.global_settings
client_config = local.client_config
settings = each.value
remote_objects = {
}
}
output "api_management_api_operation_tag" {
value = module.api_management_api_operation_tag
}
module "api_management_api_operation_policy" {
source = "./modules/apim/api_management_api_operation_policy"
for_each = local.apim.api_management_api_operation_policy
global_settings = local.global_settings
client_config = local.client_config
settings = each.value
api_name = can(each.value.api.name) ? each.value.api.name : local.combined_objects_api_management_api[try(each.value.api.lz_key, local.client_config.landingzone_key)][each.value.api.key].name
api_management_name = can(each.value.api_management.name) ? each.value.api_management.name : local.combined_objects_api_management[try(each.value.api_management.lz_key, local.client_config.landingzone_key)][each.value.api_management.key].name
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 = {
api_management = local.combined_objects_api_management
resource_group = local.combined_objects_resource_groups
api_management_api_operation = local.combined_objects_api_management_api_operation
}
}
output "api_management_api_operation_policy" {
value = module.api_management_api_operation_policy
}
module "api_management_certificate" {
source = "./modules/apim/api_management_certificate"
for_each = local.apim.api_management_certificate
global_settings = local.global_settings
client_config = local.client_config
settings = each.value
api_management_name = can(each.value.api_management.name) ? each.value.api_management.name : local.combined_objects_api_management[try(each.value.api_management.lz_key, local.client_config.landingzone_key)][each.value.api_management.key].name
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 = {
api_management = local.combined_objects_api_management
resource_group = local.combined_objects_resource_groups
keyvault_certificates = local.combined_objects_keyvault_certificates
keyvault_certificate_requests = local.combined_objects_keyvault_certificate_requests
managed_identities = local.combined_objects_managed_identities
}
}
output "api_management_certificate" {
value = module.api_management_certificate
}
module "api_management_custom_domain" {
source = "./modules/apim/api_management_custom_domain"
for_each = local.apim.api_management_custom_domain
global_settings = local.global_settings
client_config = local.client_config
settings = each.value
api_management_id = can(each.value.api_management.id) ? each.value.api_management.id : local.combined_objects_api_management[try(each.value.api_management.lz_key, local.client_config.landingzone_key)][each.value.api_management.key].id
remote_objects = {
api_management = local.combined_objects_api_management
keyvault_certificates = local.combined_objects_keyvault_certificates
keyvault_certificate_requests = local.combined_objects_keyvault_certificate_requests
}
}
output "api_management_custom_domain" {
value = module.api_management_custom_domain
}
module "api_management_diagnostic" {
source = "./modules/apim/api_management_diagnostic"
for_each = local.apim.api_management_diagnostic
global_settings = local.global_settings
client_config = local.client_config
settings = each.value
api_management_name = can(each.value.api_management.name) ? each.value.api_management.name : local.combined_objects_api_management[try(each.value.api_management.lz_key, local.client_config.landingzone_key)][each.value.api_management.key].name
resource_group_name = can(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
api_management_logger_id = can(each.value.api_management_logger.id) ? each.value.api_management_logger.id : local.combined_objects_api_management_logger[try(each.value.api_management_logger.lz_key, local.client_config.landingzone_key)][each.value.api_management_logger.key].id
remote_objects = {
api_management = local.combined_objects_api_management
resource_group = local.combined_objects_resource_groups
api_management_logger = local.combined_objects_api_management_logger
}
}
output "api_management_diagnostic" {
value = module.api_management_diagnostic
}
module "api_management_user" {
source = "./modules/apim/api_management_user"
for_each = local.apim.api_management_user
global_settings = local.global_settings
client_config = local.client_config
settings = each.value
api_management_name = can(each.value.api_management.name) ? each.value.api_management.name : local.combined_objects_api_management[try(each.value.api_management.lz_key, local.client_config.landingzone_key)][each.value.api_management.key].name
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 = {
api_management = local.combined_objects_api_management
resource_group = local.combined_objects_resource_groups
}
}
output "api_management_user" {
value = module.api_management_user
}
module "api_management_gateway" {
source = "./modules/apim/api_management_gateway"
for_each = local.apim.api_management_gateway
global_settings = local.global_settings
client_config = local.client_config
settings = each.value
remote_objects = {
api_management = local.combined_objects_api_management
resource_group = local.combined_objects_resource_groups
}
}
output "api_management_gateway" {
value = module.api_management_gateway
}
module "api_management_gateway_api" {
source = "./modules/apim/api_management_gateway_api"
for_each = local.apim.api_management_gateway_api
global_settings = local.global_settings
client_config = local.client_config
settings = each.value
remote_objects = {
api_management_api = local.combined_objects_api_management_api
api_management = local.combined_objects_api_management
resource_group = local.combined_objects_resource_groups
api_management_gateway = local.combined_objects_api_management_gateway
}
}
output "api_management_gateway_api" {
value = module.api_management_gateway_api
}
module "api_management_group" {
source = "./modules/apim/api_management_group"
for_each = local.apim.api_management_group
global_settings = local.global_settings
client_config = local.client_config
settings = each.value
remote_objects = {
api_management = local.combined_objects_api_management
resource_group = local.combined_objects_resource_groups
}
}
output "api_management_group" {
value = module.api_management_group
}
module "api_management_subscription" {
source = "./modules/apim/api_management_subscription"
for_each = local.apim.api_management_subscription
global_settings = local.global_settings
client_config = local.client_config
settings = each.value
api_management_name = can(each.value.api_management.name) ? each.value.api_management.name : local.combined_objects_api_management[try(each.value.api_management.lz_key, local.client_config.landingzone_key)][each.value.api_management.key].name
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
product_id = can(each.value.product.product_id) || can(each.value.product.key) == false ? try(each.value.product.product_id, null) : local.combined_objects_api_management_product[try(each.value.product.lz_key, local.client_config.landingzone_key)][each.value.product.key].id
remote_objects = {
api_management = local.combined_objects_api_management
resource_group = local.combined_objects_resource_groups
}
}
output "api_management_subscription" {
value = module.api_management_subscription
}
module "api_management_product" {
source = "./modules/apim/api_management_product"
for_each = local.apim.api_management_product
global_settings = local.global_settings
client_config = local.client_config
settings = each.value
api_management_name = can(each.value.api_management.name) ? each.value.api_management.name : local.combined_objects_api_management[try(each.value.api_management.lz_key, local.client_config.landingzone_key)][each.value.api_management.key].name
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 = {
api_management = local.combined_objects_api_management
resource_group = local.combined_objects_resource_groups
}
}
output "api_management_product" {
value = module.api_management_product
}