forked from terraform-ibm-modules/terraform-ibm-landing-zone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
outputs.tf
489 lines (407 loc) · 14.1 KB
/
outputs.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
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
##############################################################################
# Appid Outputs
##############################################################################
locals {
appid_instance = (
local.create_bastion_host == false # if no bastion host
? null # null
: local.create_appid == "data"
? data.ibm_resource_instance.appid
: ibm_resource_instance.appid
)
}
output "appid_name" {
description = "Name of the appid instance used."
value = local.appid_instance == null ? null : local.appid_instance[0].name
}
output "appid_key_names" {
description = "List of appid key names created"
value = [
for instance in ibm_resource_key.appid_key :
instance.name
]
}
output "appid_redirect_urls" {
description = "List of appid redirect urls"
value = ibm_appid_redirect_urls.urls[*].urls
}
##############################################################################
##############################################################################
# Atracker Outputs
##############################################################################
output "atracker_target_name" {
description = "Name of atracker target"
value = local.valid_atracker_region && var.atracker.add_route == true ? ibm_atracker_target.atracker_target[0].name : null
}
output "atracker_route_name" {
description = "Name of atracker route"
value = local.valid_atracker_region && var.atracker.add_route == true ? tolist(ibm_atracker_route.atracker_route[*].name)[0] : null
}
##############################################################################
##############################################################################
# Bastion Host Outputs
##############################################################################
output "bastion_host_names" {
description = "List of bastion host names"
value = flatten([
for instance in keys(module.bastion_host) :
module.bastion_host[instance].list[*].name
])
}
##############################################################################
##############################################################################
# Cluster Outputs
##############################################################################
output "cluster_names" {
description = "List of create cluster names"
value = flatten([
[
for cluster in ibm_container_vpc_cluster.cluster :
cluster.name
],
[
for cluster in module.cluster :
cluster.cluster_name
]
])
}
output "workload_cluster_id" {
description = "The id of the workload cluster. If the cluster name does not exactly match the prefix-workload-cluster pattern it will be null."
value = lookup(local.cluster_data, "${var.prefix}-workload-cluster", null) != null ? local.cluster_data["${var.prefix}-workload-cluster"].id : null
}
output "workload_cluster_name" {
description = "The name of the workload cluster. If the cluster name does not exactly match the prefix-workload-cluster pattern it will be null."
value = lookup(local.cluster_data, "${var.prefix}-workload-cluster", null) != null ? local.cluster_data["${var.prefix}-workload-cluster"].cluster_name : null
}
output "management_cluster_id" {
description = "The id of the management cluster. If the cluster name does not exactly match the prefix-management-cluster pattern it will be null."
value = lookup(local.cluster_data, "${var.prefix}-management-cluster", null) != null ? local.cluster_data["${var.prefix}-management-cluster"].id : null
}
output "management_cluster_name" {
description = "The name of the management cluster. If the cluster name does not exactly match the prefix-management-cluster pattern it will be null."
value = lookup(local.cluster_data, "${var.prefix}-management-cluster", null) != null ? local.cluster_data["${var.prefix}-management-cluster"].cluster_name : null
}
output "cluster_data" {
description = "List of cluster data"
value = local.cluster_data
}
##############################################################################
##############################################################################
# COS Outputs
##############################################################################
output "cos_names" {
description = "List of Cloud Object Storage instance names"
value = flatten([
[
for instance in data.ibm_resource_instance.cos :
instance.name
],
[
for instance in ibm_resource_instance.cos :
instance.name
]
])
}
output "cos_data" {
description = "List of Cloud Object Storage instance data"
value = flatten([
[
for instance in data.ibm_resource_instance.cos :
instance
],
[
for instance in ibm_resource_instance.cos :
instance
]
])
}
output "cos_key_names" {
description = "List of names for created COS keys"
value = [
for instance in ibm_resource_key.key :
instance.name
]
}
output "cos_bucket_names" {
description = "List of names for COS buckets created"
value = [
for instance in ibm_cos_bucket.buckets :
instance.bucket_name
]
}
output "cos_bucket_data" {
description = "List of data for COS buckets creaed"
value = [
for instance in ibm_cos_bucket.buckets :
instance
]
}
##############################################################################
##############################################################################
# F5 Outputs
##############################################################################
output "f5_hosts" {
description = "List of bastion host names"
value = flatten([
for instance in keys(module.f5_vsi) :
{ module.f5_vsi[instance].list[*].name : instance }
])
}
##############################################################################
##############################################################################
# VPC Outputs
##############################################################################
output "vpc_names" {
description = "List of VPC names"
value = [
for network in module.vpc :
network.vpc_name
]
}
output "vpc_data" {
description = "List of VPC data"
value = [
for k, a in module.vpc :
merge(
a,
{
vpc_data = data.ibm_is_vpc.vpc[k]
}
)
]
}
output "subnet_names" {
description = "List of Subnet names created"
value = flatten([
for network in module.vpc :
network.subnet_zone_list[*].name
])
}
output "subnet_data" {
description = "List of Subnet data created"
value = flatten([
for network in module.vpc : [
for subnet in network.subnet_zone_list :
subnet
]
])
}
output "vpc_resource_list" {
description = "List of VPC with VSI and Cluster deployed on the VPC."
value = [
for vpc in module.vpc :
{
id = vpc.vpc_data.id
name = vpc.vpc_data.name
resource_group_id = vpc.vpc_data.resource_group
region = var.region
clusters = flatten([for cluster in local.cluster_data :
cluster.id if cluster.vpc_id == vpc.vpc_data.id
])
vsi = distinct(flatten([
[
for group in keys(local.vsi_map) :
[
for deployment in module.vsi[group].list :
module.vsi[group].ids if vpc.vpc_data.id == deployment.vpc_id
]
]
]))
}
]
}
output "vpc_dns" {
description = "List of VPC DNS details for each of the VPCs."
value = [
for vpc in module.vpc :
{
dns_instance_id = vpc.dns_instance_id
dns_custom_resolver_id = vpc.dns_custom_resolver_id
}
]
}
##############################################################################
##############################################################################
# Placement Group Outputs
##############################################################################
output "placement_groups" {
description = "List of placement groups."
value = resource.ibm_is_placement_group.placement_group
}
##############################################################################
##############################################################################
# Resource Group Outputs
##############################################################################
output "resource_group_names" {
description = "List of resource groups names used within landing zone."
value = keys(local.resource_groups_info)
}
output "resource_group_data" {
description = "List of resource groups data used within landing zone."
value = local.resource_groups_info
}
##############################################################################
##############################################################################
# Security Group Outputs
##############################################################################
output "security_group_names" {
description = "List of security group names"
value = [
for group in ibm_is_security_group.security_group :
group.name
]
}
output "security_group_data" {
description = "List of security group data"
value = [
for group in ibm_is_security_group.security_group :
group
]
}
##############################################################################
##############################################################################
# Service Authorization Names
##############################################################################
output "service_authorization_names" {
description = "List of service authorization names"
value = keys(ibm_iam_authorization_policy.policy)
}
output "service_authorization_data" {
description = "List of service authorization data"
value = flatten([
for policy in ibm_iam_authorization_policy.policy :
policy
])
}
##############################################################################
##############################################################################
# SSH Key Outputs
##############################################################################
output "ssh_key_names" {
description = "List of SSH key names"
value = module.ssh_keys.ssh_keys[*].name
}
output "ssh_key_data" {
description = "List of SSH key data"
value = flatten([
for key in module.ssh_keys.ssh_keys :
key
])
}
##############################################################################
##############################################################################
# Transit Gateway Outputs
##############################################################################
output "transit_gateway_name" {
description = "Name of created transit gateway"
value = var.enable_transit_gateway ? ibm_tg_gateway.transit_gateway[0].name : null
}
output "transit_gateway_data" {
description = "Created transit gateway data"
value = var.enable_transit_gateway ? ibm_tg_gateway.transit_gateway[0] : null
}
##############################################################################
##############################################################################
# VSI Outputs
##############################################################################
output "vsi_names" {
description = "List of VSI names"
value = flatten([
for group in module.vsi :
group.list[*].name
])
}
output "fip_vsi_data" {
description = "A list of VSI with name, id, zone, and primary ipv4 address, VPC Name, and floating IP. This list only contains instances with a floating IP attached."
value = flatten([
[
for group in keys(local.vsi_map) :
[
for deployment in module.vsi[group].fip_list :
merge(deployment, {
vpc_name = [
for network in keys(local.vpc_map) :
module.vpc[network].vpc_name if module.vpc[network].vpc_id == deployment.vpc_id
][0]
})
]
]
])
}
output "vsi_data" {
description = "A list of VSI with name, id, zone, and primary ipv4 address, VPC Name, and floating IP."
value = flatten([
[
for group in keys(local.vsi_map) :
[
for deployment in module.vsi[group].list :
merge(deployment, {
vpc_name = [
for network in keys(local.vpc_map) :
module.vpc[network].vpc_name if module.vpc[network].vpc_id == deployment.vpc_id
][0]
})
]
]
])
}
##############################################################################
##############################################################################
# VPE Variables
##############################################################################
output "vpe_gateway_names" {
description = "VPE gateway names"
value = [
for gateway in ibm_is_virtual_endpoint_gateway.endpoint_gateway :
gateway.name
]
}
output "vpe_gateway_data" {
description = "List of VPE gateways data"
value = [
for gateway in ibm_is_virtual_endpoint_gateway.endpoint_gateway :
gateway
]
}
##############################################################################
##############################################################################
# VPN Names
##############################################################################
output "vpn_names" {
description = "List of VPN names"
value = [
for gateway in ibm_is_vpn_gateway.gateway :
gateway.name
]
}
output "vpn_data" {
description = "List of VPN data"
value = [
for gateway in ibm_is_vpn_gateway.gateway :
gateway
]
}
##############################################################################
# Key Management Data
##############################################################################
output "key_management_name" {
description = "Name of key management service"
value = module.key_management.key_management_name
}
output "key_management_crn" {
description = "CRN for KMS instance"
value = module.key_management.key_management_crn
}
output "key_management_guid" {
description = "GUID for KMS instance"
value = module.key_management.key_management_guid
}
output "key_rings" {
description = "Key rings created by module"
value = module.key_management.key_rings
}
output "key_map" {
description = "Map of ids and keys for keys created"
value = module.key_management.key_map
}
##############################################################################