-
Notifications
You must be signed in to change notification settings - Fork 1
/
sg-api.tf
74 lines (70 loc) · 2.02 KB
/
sg-api.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
module "api_node_sg" {
source = "github.com/terraform-aws-modules/terraform-aws-security-group.git?ref=v3.2.0"
name = var.api_sg_name
description = "All traffic"
create = local.api_enabled
vpc_id = module.vpc.vpc_id
tags = merge({
Name : var.api_sg_name
}, var.tags)
ingress_with_cidr_blocks = concat(
concat(
# static rules
[
{
from_port = 30333
to_port = 30333
protocol = "tcp"
description = ""
cidr_blocks = "0.0.0.0/0"
},
{
from_port = 51820
to_port = 51820
protocol = "udp"
description = ""
cidr_blocks = "0.0.0.0/0"
},
], [
# dynamic rules based on Polkadot network
for network in local.network_settings : {
from_port = network["api_health"]
to_port = network["api_health"]
protocol = "tcp"
description = "Health Check - ${network["name"]}"
cidr_blocks = "0.0.0.0/0"
}],
[
for network in local.network_settings : {
from_port = network["json_rpc"]
to_port = network["json_rpc"]
protocol = "tcp"
description = "JSON RPC - ${network["name"]}"
cidr_blocks = "0.0.0.0/0"
}],
[
for network in local.network_settings : {
from_port = network["ws_rpc"]
to_port = network["ws_rpc"]
protocol = "tcp"
description = "WS RPC - ${network["name"]}"
cidr_blocks = "0.0.0.0/0"
}],
), local.ssh_enabled ? [] :
[
{
from_port = 22
to_port = 22
protocol = "tcp"
description = "Security group for ssh access from coporate ip"
cidr_blocks = var.ssh_inbound_cidr_blocks
}], )
egress_with_cidr_blocks = [
{
from_port = 0
to_port = 65535
protocol = -1
description = "Egress access open to all"
cidr_blocks = "0.0.0.0/0"
}, ]
}