terrafying-components 1.6.4 → 1.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8eb41e76697fb1e2108df649dd143d91499f541267272428a6db63887a1dc49
|
4
|
+
data.tar.gz: 39b215ae41b7b5178242c807be91ee1906cbb4aa67b0aba236d74943a9b4831a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4688ecd5fb1ea22341ecad4c5871b8ada104239760145b1a6215642f858f022a9a9aa17701b7922e7af56937e335f17b899abefeab10bb455f88ac7057e4bc4b
|
7
|
+
data.tar.gz: d1f9c8998e47c90a800f5b6bc10bd8928ece5ede9d4bc128efc6a0b5000a37635b526efc4220d845933abfe5e65f2faca05ebf14495f71d796d74fed3cba32a3
|
@@ -26,6 +26,20 @@ def enrich_ports(ports)
|
|
26
26
|
}
|
27
27
|
end
|
28
28
|
|
29
|
+
def from_port(port)
|
30
|
+
return port unless port_range?(port)
|
31
|
+
port.split('-').first.to_i
|
32
|
+
end
|
33
|
+
|
34
|
+
def to_port(port)
|
35
|
+
return port unless port_range?(port)
|
36
|
+
port.split('-').last.to_i
|
37
|
+
end
|
38
|
+
|
39
|
+
def port_range?(port)
|
40
|
+
port.is_a?(String) && port.match(/[0-9]+-[0-9]+/)
|
41
|
+
end
|
42
|
+
|
29
43
|
def is_l4_port(port)
|
30
44
|
port[:type] == "tcp" || port[:type] == "udp"
|
31
45
|
end
|
@@ -103,8 +103,8 @@ module Terrafying
|
|
103
103
|
resource :aws_security_group_rule, "#{@name}-to-self-#{port[:name]}", {
|
104
104
|
security_group_id: @security_group,
|
105
105
|
type: "ingress",
|
106
|
-
from_port: port[:upstream_port],
|
107
|
-
to_port: port[:upstream_port],
|
106
|
+
from_port: from_port(port[:upstream_port]),
|
107
|
+
to_port: to_port(port[:upstream_port]),
|
108
108
|
protocol: port[:type],
|
109
109
|
self: true,
|
110
110
|
}
|
@@ -49,8 +49,8 @@ module Terrafying
|
|
49
49
|
resource :aws_security_group_rule, "#{@name}-to-#{cidr_ident}-#{port[:name]}", {
|
50
50
|
security_group_id: self.ingress_security_group,
|
51
51
|
type: "ingress",
|
52
|
-
from_port: port[:upstream_port],
|
53
|
-
to_port: port[:upstream_port],
|
52
|
+
from_port: from_port(port[:upstream_port]),
|
53
|
+
to_port: to_port(port[:upstream_port]),
|
54
54
|
protocol: port[:type] == "udp" ? "udp" : "tcp",
|
55
55
|
cidr_blocks: [cidr],
|
56
56
|
}
|
@@ -104,8 +104,8 @@ module Terrafying
|
|
104
104
|
resource :aws_security_group_rule, "#{@name}-to-#{other_resource.name}-#{port[:name]}", {
|
105
105
|
security_group_id: self.ingress_security_group,
|
106
106
|
type: "ingress",
|
107
|
-
from_port: port[:upstream_port],
|
108
|
-
to_port: port[:upstream_port],
|
107
|
+
from_port: from_port(port[:upstream_port]),
|
108
|
+
to_port: to_port(port[:upstream_port]),
|
109
109
|
protocol: port[:type] == "udp" ? "udp" : "tcp",
|
110
110
|
source_security_group_id: other_resource.egress_security_group,
|
111
111
|
}
|
@@ -113,8 +113,8 @@ module Terrafying
|
|
113
113
|
resource :aws_security_group_rule, "#{other_resource.name}-to-#{@name}-#{port[:name]}", {
|
114
114
|
security_group_id: other_resource.egress_security_group,
|
115
115
|
type: "egress",
|
116
|
-
from_port: port[:downstream_port],
|
117
|
-
to_port: port[:downstream_port],
|
116
|
+
from_port: from_port(port[:downstream_port]),
|
117
|
+
to_port: to_port(port[:downstream_port]),
|
118
118
|
protocol: port[:type] == "udp" ? "udp" : "tcp",
|
119
119
|
source_security_group_id: self.ingress_security_group,
|
120
120
|
}
|