generated from ministryofjustice/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 2
/
outputs.tf
77 lines (66 loc) · 2.21 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
output "vpc_id" {
description = "VPC ID"
value = aws_vpc.vpc.id
}
output "tgw_subnet_ids" {
description = "Transit Gateway subnet IDs"
value = [
for key, subnet in aws_subnet.subnets :
subnet.id
if substr(key, 0, 15) == "transit-gateway"
]
}
output "non_tgw_subnet_arns" {
description = "Non-Transit Gateway and Protected subnet ARNs"
value = concat(
[for key, subnet in aws_subnet.subnets : subnet.arn if substr(key, 0, 15) != "transit-gateway"],
[for key, subnet in aws_subnet.protected : subnet.arn if substr(key, 0, 15) != "transit-gateway"]
)
}
output "non_tgw_subnet_arns_by_set" {
value = {
for set, cidr in var.subnet_sets :
set => {
for key, subnet in local.expanded_worker_subnets_assocation :
"${key}-${cidr}" => aws_subnet.subnets[key].arn
if substr(key, 0, length(set)) == set
}
}
}
output "non_tgw_subnet_arns_by_subnetset" {
value = merge({
for set, cidr in var.subnet_sets : set =>
{
for key, subnet in local.expanded_worker_subnets_assocation :
"${key}-${cidr}" => aws_subnet.subnets["${subnet.key}-${subnet.type}-${subnet.az}"].arn
if substr(subnet.key, 0, length(set)) == set
}
},
{ "protected" = { for key, subnet in aws_subnet.protected : key => subnet.arn }
})
}
output "expanded_worker_subnets_assocation" {
value = local.expanded_worker_subnets_assocation
}
output "expanded_worker_subnets_with_keys" {
value = local.expanded_worker_subnets_with_keys
}
output "data_subnet_ids" {
value = [for v in aws_subnet.subnets : v.id if(length(regexall("(?:data)", v.tags.Name)) > 0)]
}
output "private_subnet_ids" {
value = [for v in aws_subnet.subnets : v.id if(length(regexall("(?:private)", v.tags.Name)) > 0)]
}
output "public_subnet_ids" {
value = [for v in aws_subnet.subnets : v.id if(length(regexall("(?:public)", v.tags.Name)) > 0)]
}
output "protected_subnet_ids" {
value = [for v in aws_subnet.protected : v.id if(length(regexall("(?:protected)", v.tags.Name)) > 0)]
}
output "private_route_tables" {
value = {
for key, value in local.all_distinct_route_tables_with_keys :
key => aws_route_table.route_tables[key].id
if substr(key, length(key) - 6, length(key)) != "public"
}
}