Skip to content

Commit b1c0a47

Browse files
committed
Remove try from bastion_tags computing
1 parent 4eabaab commit b1c0a47

1 file changed

Lines changed: 11 additions & 12 deletions

File tree

common/design/main.tf

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,17 @@ locals {
5656
# and we memorize the corresponding tags so we can determine which instances can be used as a
5757
# first hop when transferring files or executing remote commands with Terraform.
5858
agent_ip = chomp(data.http.agent_ip.response_body)
59-
bastion_tags = try([
60-
for rule, values in var.firewall_rules :
61-
values.tag
62-
if values.ethertype == "IPv4" &&
63-
22 <= values.from_port && values.to_port <= 22 &&
64-
alltrue([
65-
for i, v in split(".", local.agent_ip) :
66-
tonumber(split(".", strcontains(values.cidr, "/") ? cidrhost(values.cidr, 0) : values.cidr)[i]) <= tonumber(v) &&
67-
tonumber(split(".", strcontains(values.cidr, "/") ? cidrhost(values.cidr, -1) : values.cidr)[i]) >= tonumber(v)
68-
])
69-
],
70-
[])
59+
bastion_tags = [
60+
for rule, values in var.firewall_rules :
61+
values.tag
62+
if values.ethertype == "IPv4" &&
63+
22 <= values.from_port && values.to_port <= 22 &&
64+
alltrue([
65+
for i, v in split(".", local.agent_ip) :
66+
tonumber(split(".", strcontains(values.cidr, "/") ? cidrhost(values.cidr, 0) : values.cidr)[i]) <= tonumber(v) &&
67+
tonumber(split(".", strcontains(values.cidr, "/") ? cidrhost(values.cidr, -1) : values.cidr)[i]) >= tonumber(v)
68+
])
69+
]
7170
}
7271

7372
check "disk_space_per_tag" {

0 commit comments

Comments
 (0)