-
Notifications
You must be signed in to change notification settings - Fork 1
/
outputs.tf
68 lines (56 loc) · 1.68 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
# =====================================
# Manage firewalls in the Hetzner Cloud
# =====================================
# ------------
# Local Values
# ------------
locals {
output_firewalls = [
for name, firewall in hcloud_firewall.firewalls : merge(firewall, {
"apply_to" = null
"attachment" = try(hcloud_firewall_attachment.attachments[name], {})
})
]
output_attachments = [
for name, attachment in hcloud_firewall_attachment.attachments :
merge(attachment, {
"name" = name
"firewall_name" = try(local.attachments[name].firewall, null)
})
]
}
# -------------
# Output Values
# -------------
output "firewalls" {
description = "A list of all firewall objects."
value = local.output_firewalls
}
output "firewall_ids" {
description = "A map of all firewall objects indexed by ID."
value = {
for firewall in local.output_firewalls : firewall.id => firewall
}
}
output "firewall_names" {
description = "A map of all firewall objects indexed by name."
value = {
for firewall in local.output_firewalls : firewall.name => firewall
}
}
output "firewall_attachments" {
description = "A list of all firewall attachment objects."
value = local.output_attachments
}
output "firewall_attachment_ids" {
description = "A map of all firewall attachment objects indexed by ID."
value = {
for attachment in local.output_attachments : attachment.id => attachment
}
}
output "firewall_attachment_names" {
description = "A map of all firewall attachment objects indexed by name."
value = {
for attachment in local.output_attachments : attachment.name => attachment
}
}