ciinabox-ecs 0.3.2 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -0
- data/templates/ecs-services.rb +27 -8
- data/templates/services/jenkins.rb +195 -165
- data/templates/vpc.rb +23 -3
- data/templates/vpn.rb +13 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6cb8948addbd8934d3ce023ebe42cdc62c351543cd18e3bab5bcede51b721cd8
|
4
|
+
data.tar.gz: b9580c6df69c88aae63efa127df2c2f7776f5d43be0e3786571f2377813a120b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfaf07f44c8c9df46e421deede422ec11d8c487127164e3976b42afeb662cd395b00e261d2efd34c9efd19a136e02956fdc635f85cd0e4973667f0e44af04f28
|
7
|
+
data.tar.gz: 3a56e95ab477129ef96d2bfbb47c33ef08606c3eea4f4260410f76f3debf1c3de3bcb635f706392955cd7a4060442b70cdf72b1b1a9d61b1570eb377396a933b
|
data/README.md
CHANGED
@@ -234,6 +234,23 @@ A common update would be to lock down ip access to your ciinabox environment
|
|
234
234
|
....
|
235
235
|
```
|
236
236
|
|
237
|
+
or using AWS IP Prefix Lists
|
238
|
+
|
239
|
+
```yaml
|
240
|
+
....
|
241
|
+
#Environment Access
|
242
|
+
#add list of public IP addresses you want to access the environment from
|
243
|
+
#default to public access probably best to change this
|
244
|
+
opsIpPrefixLists:
|
245
|
+
- pl-12345
|
246
|
+
- pl-abcde
|
247
|
+
#add list of public IP addresses for your developers to access the environment
|
248
|
+
#default to public access probably best to change this
|
249
|
+
devIpPrefixLists:
|
250
|
+
- pl-11111
|
251
|
+
....
|
252
|
+
```
|
253
|
+
|
237
254
|
2. update your ciinabox
|
238
255
|
```bash
|
239
256
|
$ ciinabox-ecs generate deploy update [ciinabox_name]
|
data/templates/ecs-services.rb
CHANGED
@@ -137,20 +137,23 @@ CloudFormation {
|
|
137
137
|
])
|
138
138
|
}
|
139
139
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
140
|
+
webHooks = webHooks || []
|
141
|
+
webHooksIpPrefixLists = webHooksIpPrefixLists || []
|
142
|
+
|
143
|
+
rules = []
|
144
|
+
webHooks.each do |ip|
|
145
|
+
rules << { IpProtocol: 'tcp', FromPort: '443', ToPort: '443', CidrIp: ip }
|
146
|
+
end
|
147
|
+
|
148
|
+
webHooksIpPrefixLists.each do |list|
|
149
|
+
rules << { IpProtocol: 'tcp', FromPort: '443', ToPort: '443', SourcePrefixListId: list }
|
147
150
|
end
|
148
151
|
|
149
152
|
Resource("SecurityGroupWebHooks") {
|
150
153
|
Type 'AWS::EC2::SecurityGroup'
|
151
154
|
Property('VpcId', Ref('VPC'))
|
152
155
|
Property('GroupDescription', 'WebHooks like github')
|
153
|
-
Property('SecurityGroupIngress', rules)
|
156
|
+
Property('SecurityGroupIngress', rules) if rules.any?
|
154
157
|
}
|
155
158
|
|
156
159
|
Resource('ToolsSSLCertificate') {
|
@@ -261,6 +264,14 @@ CloudFormation {
|
|
261
264
|
end
|
262
265
|
end
|
263
266
|
|
267
|
+
log_group_retention = log_group_retention || 90
|
268
|
+
|
269
|
+
Resource("LogGroup") {
|
270
|
+
Type "AWS::Logs::LogGroup"
|
271
|
+
Property("LogGroupName", "/ciinabox/#{ciinabox_name}/proxy")
|
272
|
+
Property("RetentionInDays", log_group_retention)
|
273
|
+
}
|
274
|
+
|
264
275
|
volumes = []
|
265
276
|
mount_points = []
|
266
277
|
|
@@ -290,6 +301,14 @@ CloudFormation {
|
|
290
301
|
HostPort: 8080,
|
291
302
|
ContainerPort: 80
|
292
303
|
}],
|
304
|
+
LogConfiguration: {
|
305
|
+
LogDriver: 'awslogs',
|
306
|
+
Options: {
|
307
|
+
'awslogs-group' => Ref("LogGroup"),
|
308
|
+
"awslogs-region" => Ref("AWS::Region"),
|
309
|
+
"awslogs-stream-prefix" => "proxy"
|
310
|
+
}
|
311
|
+
},
|
293
312
|
Essential: true,
|
294
313
|
MountPoints: mount_points
|
295
314
|
}
|
@@ -1,189 +1,219 @@
|
|
1
1
|
require 'cfndsl'
|
2
2
|
require_relative '../../ext/helper'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
# Prefixing application images allows us to 'vendorize' ciinabox into client's account by setting
|
17
|
-
# ciinabox_repo to ${account_no}.dkr.ecr.${region}.amazonaws.com
|
18
|
-
if not defined? ciinabox_repo
|
19
|
-
ciinabox_repo = 'ghcr.io/base2services'
|
20
|
-
end
|
21
|
-
image = "#{ciinabox_repo}/ciinabox-jenkins:lts"
|
22
|
-
|
23
|
-
jenkins_java_opts = ''
|
24
|
-
memory = 2048
|
25
|
-
slave_memory = 2048
|
26
|
-
cpu = 300
|
27
|
-
container_port = 0
|
28
|
-
service = lookup_service('jenkins', services)
|
29
|
-
virtual_host = "jenkins.#{dns_domain}"
|
30
|
-
if defined? internal_elb and internal_elb
|
31
|
-
virtual_host = "#{virtual_host},internal-jenkins.#{dns_domain}"
|
32
|
-
end
|
33
|
-
port_mappings = []
|
34
|
-
|
35
|
-
if defined? service
|
36
|
-
service = {} if service.nil?
|
37
|
-
jenkins_java_opts = service['JAVA_OPTS'] || ''
|
38
|
-
image = service['ContainerImage'] || image
|
39
|
-
memory = service['ContainerMemory'] || 2048
|
40
|
-
slave_memory = service['SlaveContainerMemory'] || 2048
|
41
|
-
cpu = service['ContainerCPU'] || 300
|
42
|
-
|
43
|
-
if service['InstancePort']
|
44
|
-
port_mappings << {
|
45
|
-
HostPort: service['InstancePort'],
|
46
|
-
ContainerPort: service['InstancePort']
|
47
|
-
}
|
48
|
-
container_port = service['InstancePort']
|
49
|
-
virtual_host = "jenkins.#{dns_domain},internal-jenkins.#{dns_domain}"
|
4
|
+
CloudFormation {
|
5
|
+
AWSTemplateFormatVersion "2010-09-09"
|
6
|
+
Description "ciinabox - ECS Service Jenkins v#{ciinabox_version}"
|
7
|
+
|
8
|
+
Parameter("ECSCluster") {Type 'String'}
|
9
|
+
Parameter("ECSRole") {Type 'String'}
|
10
|
+
Parameter("ServiceELB") {Type 'String'}
|
11
|
+
Parameter('InternalELB') {Type 'String'} if internal_elb
|
12
|
+
|
13
|
+
if !defined? timezone
|
14
|
+
timezone = 'GMT'
|
50
15
|
end
|
51
16
|
|
52
|
-
|
17
|
+
if !defined? internal_elb
|
18
|
+
internal_elb = nil
|
19
|
+
end
|
53
20
|
|
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
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
21
|
+
if !defined? volatile_jenkins_slave
|
22
|
+
volatile_jenkins_slave = false
|
23
|
+
end
|
24
|
+
|
25
|
+
# Prefixing application images allows us to 'vendorize' ciinabox into client's account by setting
|
26
|
+
# ciinabox_repo to ${account_no}.dkr.ecr.${region}.amazonaws.com
|
27
|
+
if not defined? ciinabox_repo
|
28
|
+
ciinabox_repo = 'ghcr.io/base2services'
|
29
|
+
end
|
30
|
+
image = "#{ciinabox_repo}/ciinabox-jenkins:lts"
|
31
|
+
|
32
|
+
jenkins_java_opts = ''
|
33
|
+
memory = 2048
|
34
|
+
slave_memory = 2048
|
35
|
+
cpu = 300
|
36
|
+
container_port = 0
|
37
|
+
service = lookup_service('jenkins', services)
|
38
|
+
virtual_host = "jenkins.#{dns_domain}"
|
39
|
+
if defined? internal_elb and internal_elb
|
40
|
+
virtual_host = "#{virtual_host},internal-jenkins.#{dns_domain}"
|
41
|
+
end
|
42
|
+
port_mappings = []
|
43
|
+
|
44
|
+
if defined? service
|
45
|
+
service = {} if service.nil?
|
46
|
+
jenkins_java_opts = service['JAVA_OPTS'] || ''
|
47
|
+
image = service['ContainerImage'] || image
|
48
|
+
memory = service['ContainerMemory'] || 2048
|
49
|
+
slave_memory = service['SlaveContainerMemory'] || 2048
|
50
|
+
cpu = service['ContainerCPU'] || 300
|
51
|
+
|
52
|
+
if service['InstancePort']
|
53
|
+
port_mappings << {
|
54
|
+
HostPort: service['InstancePort'],
|
55
|
+
ContainerPort: service['InstancePort']
|
56
|
+
}
|
57
|
+
container_port = service['InstancePort']
|
58
|
+
virtual_host = "jenkins.#{dns_domain},internal-jenkins.#{dns_domain}"
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
# container volumes and container definitions depending on feature flags
|
64
|
+
volumes = [
|
65
|
+
{
|
66
|
+
Name: 'timezone',
|
67
|
+
Host: {
|
68
|
+
SourcePath: '/etc/localtime'
|
69
|
+
}
|
70
|
+
},
|
71
|
+
{
|
72
|
+
Name: 'jenkins_data',
|
73
|
+
Host: {
|
74
|
+
SourcePath: '/data/jenkins'
|
75
|
+
}
|
76
|
+
}]
|
77
|
+
|
78
|
+
container_definitions = [
|
79
|
+
{
|
80
|
+
Name: 'jenkins',
|
81
|
+
Links: [],
|
82
|
+
Memory: memory,
|
83
|
+
Cpu: cpu,
|
84
|
+
Image: image,
|
85
|
+
PortMappings: port_mappings,
|
86
|
+
Environment: [
|
87
|
+
{
|
88
|
+
Name: 'JAVA_OPTS',
|
89
|
+
Value: "#{jenkins_java_opts} -Duser.timezone=#{timezone}"
|
90
|
+
},
|
91
|
+
{
|
92
|
+
Name: 'VIRTUAL_HOST',
|
93
|
+
Value: virtual_host
|
94
|
+
},
|
95
|
+
{
|
96
|
+
Name: 'VIRTUAL_PORT',
|
97
|
+
Value: '8080'
|
98
|
+
}
|
99
|
+
],
|
100
|
+
LogConfiguration: {
|
101
|
+
LogDriver: 'awslogs',
|
102
|
+
Options: {
|
103
|
+
'awslogs-group' => Ref("LogGroup"),
|
104
|
+
"awslogs-region" => Ref("AWS::Region"),
|
105
|
+
"awslogs-stream-prefix" => "jenkins"
|
106
|
+
}
|
107
|
+
},
|
108
|
+
Essential: true,
|
109
|
+
MountPoints: [
|
110
|
+
{
|
111
|
+
ContainerPath: '/etc/localtime',
|
112
|
+
SourceVolume: 'timezone',
|
113
|
+
ReadOnly: true
|
114
|
+
},
|
115
|
+
{
|
116
|
+
ContainerPath: '/var/jenkins_home',
|
117
|
+
SourceVolume: 'jenkins_data',
|
118
|
+
ReadOnly: false
|
119
|
+
}
|
120
|
+
]
|
121
|
+
}
|
122
|
+
]
|
123
|
+
|
124
|
+
# If docker in docker slave is enabled
|
125
|
+
if defined? include_diind_slave and include_diind_slave
|
126
|
+
container_definitions[0][:Links] << 'jenkins-docker-dind-slave'
|
127
|
+
dind_definition = {
|
128
|
+
Name: 'jenkins-docker-dind-slave',
|
129
|
+
Memory: slave_memory,
|
130
|
+
Image: "#{ciinabox_repo}/ciinabox-docker-slave:#{docker_slave_version}",
|
131
|
+
Environment: [{Name: 'RUN_DOCKER_IN_DOCKER', Value: 1}],
|
132
|
+
LogConfiguration: {
|
133
|
+
LogDriver: 'awslogs',
|
134
|
+
Options: {
|
135
|
+
'awslogs-group' => Ref("LogGroup"),
|
136
|
+
"awslogs-region" => Ref("AWS::Region"),
|
137
|
+
"awslogs-stream-prefix" => "jenkins-docker-dind-slave"
|
138
|
+
}
|
139
|
+
},
|
140
|
+
Essential: false,
|
141
|
+
Privileged: true
|
142
|
+
}
|
143
|
+
dind_definition[:Environment] << { Name: 'USE_ECR_CREDENTIAL_HELPER', Value: 1 } if docker_slave_enable_ecr_credentials_helper
|
144
|
+
if not volatile_jenkins_slave
|
145
|
+
dind_definition[:MountPoints] = [
|
146
|
+
{
|
147
|
+
ContainerPath: '/var/lib/docker',
|
148
|
+
SourceVolume: 'jenkins_dind_data',
|
149
|
+
ReadOnly: false
|
150
|
+
}
|
151
|
+
]
|
152
|
+
volumes << {
|
153
|
+
Name: 'jenkins_dind_data',
|
154
|
+
Host: {
|
155
|
+
SourcePath: '/data/jenkins-diind'
|
156
|
+
}
|
157
|
+
}
|
158
|
+
end
|
159
|
+
container_definitions << dind_definition
|
160
|
+
|
161
|
+
end
|
162
|
+
|
163
|
+
# If docker outside of docker slave is enabled
|
164
|
+
if defined? include_dood_slave and include_dood_slave
|
165
|
+
container_definitions[0][:Links] << 'jenkins-docker-dood-slave'
|
166
|
+
dood_definition = {
|
167
|
+
Name: 'jenkins-docker-dood-slave',
|
168
|
+
Memory: slave_memory,
|
169
|
+
Image: "#{ciinabox_repo}/ciinabox-docker-slave:#{docker_slave_version}",
|
170
|
+
Environment: [{Name: 'RUN_DOCKER_IN_DOCKER', Value: 0}],
|
171
|
+
LogConfiguration: {
|
172
|
+
LogDriver: 'awslogs',
|
173
|
+
Options: {
|
174
|
+
'awslogs-group' => Ref("LogGroup"),
|
175
|
+
"awslogs-region" => Ref("AWS::Region"),
|
176
|
+
"awslogs-stream-prefix" => "jenkins-docker-dood-slave"
|
177
|
+
}
|
178
|
+
},
|
92
179
|
MountPoints: [
|
93
180
|
{
|
94
|
-
ContainerPath: '/
|
95
|
-
SourceVolume: '
|
96
|
-
ReadOnly:
|
181
|
+
ContainerPath: '/var/run/docker.sock',
|
182
|
+
SourceVolume: 'docker_socket',
|
183
|
+
ReadOnly: false
|
97
184
|
},
|
98
185
|
{
|
99
|
-
ContainerPath: '/
|
100
|
-
SourceVolume: '
|
186
|
+
ContainerPath: '/data/jenkins-dood',
|
187
|
+
SourceVolume: 'jenkins_dood_data',
|
101
188
|
ReadOnly: false
|
102
189
|
}
|
103
|
-
]
|
190
|
+
],
|
191
|
+
Essential: false,
|
192
|
+
Privileged: false
|
104
193
|
}
|
105
|
-
]
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
Name: 'jenkins-docker-dind-slave',
|
112
|
-
Memory: slave_memory,
|
113
|
-
Image: "#{ciinabox_repo}/ciinabox-docker-slave:#{docker_slave_version}",
|
114
|
-
Environment: [{Name: 'RUN_DOCKER_IN_DOCKER', Value: 1}],
|
115
|
-
Essential: false,
|
116
|
-
Privileged: true
|
117
|
-
}
|
118
|
-
dind_definition[:Environment] << { Name: 'USE_ECR_CREDENTIAL_HELPER', Value: 1 } if docker_slave_enable_ecr_credentials_helper
|
119
|
-
if not volatile_jenkins_slave
|
120
|
-
dind_definition[:MountPoints] = [
|
121
|
-
{
|
122
|
-
ContainerPath: '/var/lib/docker',
|
123
|
-
SourceVolume: 'jenkins_dind_data',
|
124
|
-
ReadOnly: false
|
194
|
+
dood_definition[:Environment] << { Name: 'USE_ECR_CREDENTIAL_HELPER', Value: 1 } if docker_slave_enable_ecr_credentials_helper
|
195
|
+
container_definitions << dood_definition
|
196
|
+
volumes << {
|
197
|
+
Name: 'jenkins_dood_data',
|
198
|
+
Host: {
|
199
|
+
SourcePath: '/data/jenkins-dood'
|
125
200
|
}
|
126
|
-
|
201
|
+
}
|
127
202
|
volumes << {
|
128
|
-
Name: '
|
203
|
+
Name: 'docker_socket',
|
129
204
|
Host: {
|
130
|
-
SourcePath: '/
|
205
|
+
SourcePath: '/var/run/docker.sock'
|
131
206
|
}
|
132
207
|
}
|
133
208
|
end
|
134
|
-
container_definitions << dind_definition
|
135
|
-
|
136
|
-
end
|
137
|
-
|
138
|
-
# If docker outside of docker slave is enabled
|
139
|
-
if defined? include_dood_slave and include_dood_slave
|
140
|
-
container_definitions[0][:Links] << 'jenkins-docker-dood-slave'
|
141
|
-
dood_definition = {
|
142
|
-
Name: 'jenkins-docker-dood-slave',
|
143
|
-
Memory: slave_memory,
|
144
|
-
Image: "#{ciinabox_repo}/ciinabox-docker-slave:#{docker_slave_version}",
|
145
|
-
Environment: [{Name: 'RUN_DOCKER_IN_DOCKER', Value: 0}],
|
146
|
-
MountPoints: [
|
147
|
-
{
|
148
|
-
ContainerPath: '/var/run/docker.sock',
|
149
|
-
SourceVolume: 'docker_socket',
|
150
|
-
ReadOnly: false
|
151
|
-
},
|
152
|
-
{
|
153
|
-
ContainerPath: '/data/jenkins-dood',
|
154
|
-
SourceVolume: 'jenkins_dood_data',
|
155
|
-
ReadOnly: false
|
156
|
-
}
|
157
|
-
],
|
158
|
-
Essential: false,
|
159
|
-
Privileged: false
|
160
|
-
}
|
161
|
-
dood_definition[:Environment] << { Name: 'USE_ECR_CREDENTIAL_HELPER', Value: 1 } if docker_slave_enable_ecr_credentials_helper
|
162
|
-
container_definitions << dood_definition
|
163
|
-
volumes << {
|
164
|
-
Name: 'jenkins_dood_data',
|
165
|
-
Host: {
|
166
|
-
SourcePath: '/data/jenkins-dood'
|
167
|
-
}
|
168
|
-
}
|
169
|
-
volumes << {
|
170
|
-
Name: 'docker_socket',
|
171
|
-
Host: {
|
172
|
-
SourcePath: '/var/run/docker.sock'
|
173
|
-
}
|
174
|
-
}
|
175
|
-
end
|
176
|
-
|
177
209
|
|
178
|
-
|
210
|
+
log_group_retention = log_group_retention || 90
|
179
211
|
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
Parameter("ServiceELB") {Type 'String'}
|
186
|
-
Parameter('InternalELB') {Type 'String'} if internal_elb
|
212
|
+
Resource("LogGroup") {
|
213
|
+
Type "AWS::Logs::LogGroup"
|
214
|
+
Property("LogGroupName", "/ciinabox/#{ciinabox_name}/jenkins")
|
215
|
+
Property("RetentionInDays", log_group_retention)
|
216
|
+
}
|
187
217
|
|
188
218
|
Resource('JenkinsTask') {
|
189
219
|
Type "AWS::ECS::TaskDefinition"
|
data/templates/vpc.rb
CHANGED
@@ -158,6 +158,9 @@ CloudFormation {
|
|
158
158
|
end
|
159
159
|
|
160
160
|
rules = []
|
161
|
+
|
162
|
+
opsAccess = opsAccess || []
|
163
|
+
|
161
164
|
opsAccess.each do |ip|
|
162
165
|
rules << { IpProtocol: 'tcp', FromPort: '22', ToPort: '22', CidrIp: ip }
|
163
166
|
rules << { IpProtocol: 'tcp', FromPort: '80', ToPort: '80', CidrIp: ip }
|
@@ -167,14 +170,24 @@ CloudFormation {
|
|
167
170
|
rules << { IpProtocol: 'tcp', FromPort: '50000', ToPort: '50000', CidrIp: ip }
|
168
171
|
end
|
169
172
|
|
173
|
+
opsIpPrefixLists = opsIpPrefixLists || []
|
174
|
+
|
175
|
+
opsIpPrefixLists.each do |list|
|
176
|
+
rules << { IpProtocol: 'tcp', FromPort: '80', ToPort: '80', SourcePrefixListId: list }
|
177
|
+
rules << { IpProtocol: 'tcp', FromPort: '443', ToPort: '443', SourcePrefixListId: list }
|
178
|
+
end
|
179
|
+
|
170
180
|
Resource("SecurityGroupOps") {
|
171
181
|
Type 'AWS::EC2::SecurityGroup'
|
172
182
|
Property('VpcId', Ref('VPC'))
|
173
183
|
Property('GroupDescription', 'Ops External Access')
|
174
|
-
Property('SecurityGroupIngress', rules)
|
184
|
+
Property('SecurityGroupIngress', rules) if rules.any?
|
175
185
|
}
|
176
186
|
|
177
187
|
rules = []
|
188
|
+
|
189
|
+
devAccess = devAccess || []
|
190
|
+
|
178
191
|
devAccess.each do |ip|
|
179
192
|
rules << { IpProtocol: 'tcp', FromPort: '22', ToPort: '22', CidrIp: ip }
|
180
193
|
rules << { IpProtocol: 'tcp', FromPort: '80', ToPort: '80', CidrIp: ip }
|
@@ -184,11 +197,18 @@ CloudFormation {
|
|
184
197
|
rules << { IpProtocol: 'tcp', FromPort: '50000', ToPort: '50000', CidrIp: ip }
|
185
198
|
end
|
186
199
|
|
200
|
+
devIpPrefixLists = devIpPrefixLists || []
|
201
|
+
|
202
|
+
devIpPrefixLists.each do |list|
|
203
|
+
rules << { IpProtocol: 'tcp', FromPort: '80', ToPort: '80', SourcePrefixListId: list }
|
204
|
+
rules << { IpProtocol: 'tcp', FromPort: '443', ToPort: '443', SourcePrefixListId: list }
|
205
|
+
end
|
206
|
+
|
187
207
|
Resource("SecurityGroupDev") {
|
188
208
|
Type 'AWS::EC2::SecurityGroup'
|
189
209
|
Property('VpcId', Ref('VPC'))
|
190
210
|
Property('GroupDescription', 'Dev Team Access')
|
191
|
-
Property('SecurityGroupIngress', rules)
|
211
|
+
Property('SecurityGroupIngress', rules) if rules.any?
|
192
212
|
}
|
193
213
|
|
194
214
|
|
@@ -286,4 +306,4 @@ CloudFormation {
|
|
286
306
|
Value(Ref('SecurityGroupDev'))
|
287
307
|
}
|
288
308
|
|
289
|
-
}
|
309
|
+
}
|
data/templates/vpn.rb
CHANGED
@@ -41,6 +41,9 @@ CloudFormation do
|
|
41
41
|
security_groups << Ref('VpnSecurityGroupOps')
|
42
42
|
|
43
43
|
rules = []
|
44
|
+
|
45
|
+
devAccess = devAccess || []
|
46
|
+
|
44
47
|
devAccess.each do |ip|
|
45
48
|
rules << { IpProtocol: 'tcp', FromPort: '443', ToPort: '443', CidrIp: ip }
|
46
49
|
rules << { IpProtocol: 'tcp', FromPort: '9443', ToPort: '9443', CidrIp: ip }
|
@@ -48,11 +51,20 @@ CloudFormation do
|
|
48
51
|
rules << { IpProtocol: 'udp', FromPort: '1194', ToPort: '1194', CidrIp: ip }
|
49
52
|
end
|
50
53
|
|
54
|
+
devIpPrefixLists = devIpPrefixLists || []
|
55
|
+
|
56
|
+
devIpPrefixLists.each do |list|
|
57
|
+
rules << { IpProtocol: 'tcp', FromPort: '443', ToPort: '443', SourcePrefixListId: list }
|
58
|
+
rules << { IpProtocol: 'tcp', FromPort: '9443', ToPort: '9443', SourcePrefixListId: list }
|
59
|
+
rules << { IpProtocol: 'tcp', FromPort: '943', ToPort: '943', SourcePrefixListId: list }
|
60
|
+
rules << { IpProtocol: 'udp', FromPort: '1194', ToPort: '1194', SourcePrefixListId: list }
|
61
|
+
end
|
62
|
+
|
51
63
|
Resource("VpnSecurityGroupDev") {
|
52
64
|
Type 'AWS::EC2::SecurityGroup'
|
53
65
|
Property('VpcId', Ref('VPC'))
|
54
66
|
Property('GroupDescription', 'Dev Team Access')
|
55
|
-
Property('SecurityGroupIngress', rules)
|
67
|
+
Property('SecurityGroupIngress', rules) if rules.any?
|
56
68
|
}
|
57
69
|
|
58
70
|
security_groups << Ref('VpnSecurityGroupDev')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ciinabox-ecs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Base2Services
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -169,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
169
|
- !ruby/object:Gem::Version
|
170
170
|
version: '0'
|
171
171
|
requirements: []
|
172
|
-
rubygems_version: 3.
|
172
|
+
rubygems_version: 3.1.6
|
173
173
|
signing_key:
|
174
174
|
specification_version: 4
|
175
175
|
summary: Manage ciinabox on Aws Ecs
|