-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocals.tf
30 lines (27 loc) · 863 Bytes
/
locals.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
locals {
prefix = var.project_prefix != "" ? var.project_prefix : "${random_string.prefix.0.result}-lab"
ssh_key_id = var.existing_ssh_key != "" ? [data.ibm_is_ssh_key.sshkey[0].id] : [ibm_is_ssh_key.generated_key[0].id]
tags = [
"owner:${var.owner}",
"provider:ibm",
"region:${var.region}",
"vpc:${local.prefix}-vpc"
]
zones = length(data.ibm_is_zones.regional.zones)
vpc_zones = {
for zone in range(local.zones) : zone => {
zone = "${var.region}-${zone + 1}"
}
}
frontend_rules = [
for r in var.frontend_rules : {
name = r.name
direction = r.direction
remote = lookup(r, "remote", null)
ip_version = lookup(r, "ip_version", null)
icmp = lookup(r, "icmp", null)
tcp = lookup(r, "tcp", null)
udp = lookup(r, "udp", null)
}
]
}