forked from terraform-ibm-modules/terraform-ibm-satellite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocals.tf
87 lines (83 loc) · 2.04 KB
/
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
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
85
86
87
#####################################################
# IBM Cloud Satellite - IBM Example
# Copyright 2021 IBM
#####################################################
locals {
location_zones = var.location_zones != null && length(var.location_zones) == 3 ? var.location_zones : ["${var.region}-1", "${var.region}-2", "${var.region}-3"]
subnet_ids = [ibm_is_subnet.satellite_subnet[0].id, ibm_is_subnet.satellite_subnet[1].id, ibm_is_subnet.satellite_subnet[2].id]
sg_rules = [
for r in local.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)
}
]
rules = [
{
name = "${var.is_prefix}-ingress-1"
direction = "inbound"
remote = "0.0.0.0/0"
tcp = {
port_min = 22
port_max = 22
}
},
{
name = "${var.is_prefix}-ingress-2"
direction = "inbound"
remote = "0.0.0.0/0"
tcp = {
port_min = 80
port_max = 80
}
},
{
name = "${var.is_prefix}-ingress-3"
direction = "inbound"
remote = "0.0.0.0/0"
tcp = {
port_min = 443
port_max = 443
}
},
{
name = "${var.is_prefix}-ingress-4"
direction = "inbound"
remote = "0.0.0.0/0"
tcp = {
port_min = 30000
port_max = 32767
}
},
{
name = "${var.is_prefix}-ingress-5"
direction = "inbound"
remote = "0.0.0.0/0"
udp = {
port_min = 30000
port_max = 32767
}
},
{
name = "${var.is_prefix}-ingress-6"
direction = "inbound"
icmp = {
type = 8
code = null
}
},
{
name = "${var.is_prefix}-egress-1"
direction = "outbound"
remote = "0.0.0.0/0"
tcp = {
port_min = 1
port_max = 65535
}
}
]
}