-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathoutput.tf
84 lines (78 loc) · 3.32 KB
/
output.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
output "vnet" {
description = "Virtual network data object."
value = azurerm_virtual_network.vnet
}
output "subnet" {
description = "Map of subnet data objects."
value = zipmap(
[for subnet in module.subnet : subnet.name],
[for subnet in module.subnet : subnet.subnet]
)
}
output "subnet_nsg_ids" {
description = "Map of subnet ids to associated network_security_group ids."
value = zipmap(
[for subnet in module.subnet : subnet.id],
[for subnet in module.subnet : subnet.network_security_group_id]
)
}
output "subnet_nsg_names" {
description = "Map of subnet names to associated network_security_group names."
value = zipmap(
[for subnet in module.subnet : subnet.name],
[for subnet in module.subnet : subnet.network_security_group_name]
)
}
output "subnets" {
description = "Maps of subnet info."
value = zipmap(
[for subnet in module.subnet : subnet.subnet.name],
[for subnet in module.subnet : {
name = subnet.subnet.name
id = subnet.subnet.id
resource_group_name = subnet.subnet.resource_group_name
address_prefixes = subnet.subnet.address_prefixes
service_endpoints = subnet.subnet.service_endpoints
network_security_group_name = subnet.network_security_group_name
network_security_group_id = subnet.network_security_group_id
virtual_network_name = azurerm_virtual_network.vnet.name
virtual_network_id = azurerm_virtual_network.vnet.id
route_table_id = (contains(keys(local.route_table_associations), subnet.subnet.name) ?
azurerm_subnet_route_table_association.association[subnet.subnet.name].route_table_id :
null)
}]
)
}
output "aks" {
description = "Virtual network information matching AKS module input."
value = { for aks_id, info in local.aks_info :
aks_id => {
subnet = {
name = module.aks_subnet["aks-${aks_id}"].subnet.name
id = module.aks_subnet["aks-${aks_id}"].subnet.id
resource_group_name = module.aks_subnet["aks-${aks_id}"].subnet.resource_group_name
address_prefixes = module.aks_subnet["aks-${aks_id}"].subnet.address_prefixes
service_endpoints = module.aks_subnet["aks-${aks_id}"].subnet.service_endpoints
network_security_group_id = module.aks_subnet["aks-${aks_id}"].network_security_group_id
network_security_group_name = module.aks_subnet["aks-${aks_id}"].network_security_group_name
virtual_network_name = azurerm_virtual_network.vnet.name
virtual_network_id = azurerm_virtual_network.vnet.id
route_table_id = azurerm_route_table.aks_route_table[aks_id].id
}
route_table = {
id = azurerm_route_table.aks_route_table[aks_id].id
name = azurerm_route_table.aks_route_table[aks_id].name
}
}
}
}
output "route_tables" {
description = "Maps of custom route tables."
value = { for k, v in var.route_tables :
k => {
name = azurerm_route_table.route_table[k].name
id = azurerm_route_table.route_table[k].id
subnets = azurerm_route_table.route_table[k].subnets
}
}
}