rubycfn 0.4.10 → 0.5.4
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 +4 -4
- data/CHANGELOG.md +22 -1
- data/Gemfile.lock +48 -46
- data/README.md +46 -71
- data/bin/rubycfn +17 -73
- data/lib/cli_methods.rb +2 -2
- data/lib/rubycfn/version.rb +1 -1
- data/rubycfn.gemspec +1 -1
- data/templates/.env +2 -0
- data/templates/.env.acceptance +1 -0
- data/templates/.env.dependencies.rspec +6 -0
- data/templates/.env.development +1 -0
- data/templates/.env.production +1 -0
- data/templates/.env.rspec +1 -0
- data/templates/.env.test +1 -0
- data/templates/{.gitignore.erb → .gitignore} +7 -0
- data/templates/{.rubocop.yml.erb → .rubocop.yml} +17 -1
- data/templates/{Gemfile.erb → Gemfile} +0 -1
- data/templates/README.md +58 -0
- data/templates/{Rakefile.erb → Rakefile} +15 -8
- data/templates/config.yaml +68 -0
- data/templates/lib/aws_helper/aws_sdk.rb +30 -0
- data/templates/{compiler.rb.erb → lib/aws_helper/compiler.rb} +15 -9
- data/templates/lib/aws_helper/dependencies.rb +35 -0
- data/templates/{deploy.rb.erb → lib/aws_helper/deploy.rb} +5 -4
- data/templates/lib/aws_helper/helpers.rb +3 -0
- data/templates/{main_aws_helper.rb.erb → lib/aws_helper/main.rb} +0 -0
- data/templates/{upload_stack.rb.erb → lib/aws_helper/upload_stack.rb} +8 -6
- data/templates/lib/core/applications.rb +625 -0
- data/templates/lib/core/assume_role.rb +40 -0
- data/templates/lib/core/classes.rb +25 -0
- data/templates/{core_compile.rb.erb → lib/core/compile.rb} +1 -0
- data/templates/lib/core/dependencies.rb +29 -0
- data/templates/{core_deploy.rb.erb → lib/core/deploy.rb} +20 -10
- data/templates/lib/core/git.rb +15 -0
- data/templates/lib/core/init.rb +221 -0
- data/templates/{core_upload.rb.erb → lib/core/upload.rb} +0 -0
- data/templates/{main.rb.erb → lib/main.rb} +8 -6
- data/templates/lib/shared_concerns/global_variables.rb +56 -0
- data/templates/{helper_methods.rb.erb → lib/shared_concerns/helper_functions.rb} +0 -0
- data/templates/lib/shared_concerns/helper_methods.rb +3 -0
- data/templates/{shared_methods.rb.erb → lib/shared_concerns/shared_methods.rb} +11 -0
- data/templates/lib/stacks/acm_stack/certificate_manager.rb +79 -0
- data/templates/{new_stack.rb.erb → lib/stacks/acm_stack/main.rb} +3 -4
- data/templates/lib/stacks/ecs_stack/ecs_cluster.rb +344 -0
- data/templates/lib/stacks/ecs_stack/lifecycle_hook.rb +190 -0
- data/templates/lib/stacks/ecs_stack/load_balancer.rb +70 -0
- data/templates/{ecs_stack.rb.erb → lib/stacks/ecs_stack/main.rb} +3 -0
- data/templates/lib/stacks/ecs_stack/rollback.rb +77 -0
- data/templates/{project_stack.rb.erb → lib/stacks/parent_stack/main.rb} +2 -2
- data/templates/lib/stacks/parent_stack/parent.rb +18 -0
- data/templates/lib/stacks/vpc_stack/infra_vpc.rb +193 -0
- data/templates/{vpc_stack.rb.erb → lib/stacks/vpc_stack/main.rb} +1 -2
- data/templates/{parent_stack_spec.rb.erb → spec/lib/parent_spec.rb} +2 -5
- data/templates/{spec_helper.rb.erb → spec/spec_helper.rb} +2 -2
- metadata +61 -51
- data/format.vim +0 -3
- data/templates/.env.erb +0 -4
- data/templates/.env.production.erb +0 -6
- data/templates/.env.rspec.erb +0 -6
- data/templates/.env.test.erb +0 -6
- data/templates/.gitlab-ci.yml.erb +0 -75
- data/templates/aws_sdk.rb.erb +0 -18
- data/templates/core_diff.rb.erb +0 -59
- data/templates/dependencies.rb.erb +0 -23
- data/templates/ecs_stack_concern.rb.erb +0 -20
- data/templates/global_variables.rb.erb +0 -16
- data/templates/helpers.rb.erb +0 -7
- data/templates/new_concern.rb.erb +0 -10
- data/templates/project_concern.rb.erb +0 -26
- data/templates/subnets.rb.erb +0 -18
- data/templates/vpc_concerns.rb.erb +0 -87
- data/templates/vpc_spec.rb.erb +0 -39
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
module VpcStack
|
|
2
2
|
extend ActiveSupport::Concern
|
|
3
3
|
include Rubycfn
|
|
4
|
-
|
|
5
4
|
included do
|
|
6
5
|
include Concerns::GlobalVariables
|
|
7
6
|
include Concerns::SharedMethods
|
|
8
|
-
include VpcStack::
|
|
7
|
+
include VpcStack::InfraVpc
|
|
9
8
|
|
|
10
9
|
description generate_stack_description("VpcStack")
|
|
11
10
|
end
|
|
@@ -8,10 +8,10 @@ module ParentSpec
|
|
|
8
8
|
include Rubycfn
|
|
9
9
|
|
|
10
10
|
included do
|
|
11
|
-
description "
|
|
11
|
+
description "Infra Stack RSpec"
|
|
12
12
|
include Concerns::GlobalVariables
|
|
13
13
|
include Concerns::SharedMethods
|
|
14
|
-
include
|
|
14
|
+
include InfraStack::Parent
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
|
|
@@ -23,15 +23,12 @@ describe ParentSpec do
|
|
|
23
23
|
|
|
24
24
|
context "Renders template" do
|
|
25
25
|
subject { template }
|
|
26
|
-
|
|
27
26
|
it { should have_key "Resources" }
|
|
28
27
|
|
|
29
28
|
context "Has Required Resources" do
|
|
30
29
|
let(:resources) { template["Resources"] }
|
|
31
30
|
subject { resources }
|
|
32
31
|
|
|
33
|
-
it { should have_key "VpcStack" }
|
|
34
|
-
it { should have_key "EcsStack" }
|
|
35
32
|
end
|
|
36
33
|
end
|
|
37
34
|
end
|
|
@@ -22,7 +22,7 @@ RSpec.configure do |config|
|
|
|
22
22
|
config.filter_run_excluding broken: true
|
|
23
23
|
config.filter_run_excluding turn_off: true
|
|
24
24
|
config.filter_run focus: true
|
|
25
|
-
config.run_all_when_everything_filtered = true
|
|
26
25
|
config.filter_run_excluding :slow unless ENV["SLOW_SPECS"]
|
|
27
26
|
config.filter_run_excluding :debug unless ENV["DEBUG_SPECS"]
|
|
28
|
-
|
|
27
|
+
config.run_all_when_everything_filtered = true
|
|
28
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rubycfn
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4
|
|
4
|
+
version: 0.5.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dennis Vink
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2021-07-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: neatjson
|
|
@@ -30,14 +30,14 @@ dependencies:
|
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: 2.
|
|
33
|
+
version: 2.3.0
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: 2.
|
|
40
|
+
version: 2.3.0
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: activesupport
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -265,7 +265,6 @@ files:
|
|
|
265
265
|
- README.md
|
|
266
266
|
- Rakefile
|
|
267
267
|
- bin/rubycfn
|
|
268
|
-
- format.vim
|
|
269
268
|
- lib/cli_methods.rb
|
|
270
269
|
- lib/monkeypatch.rb
|
|
271
270
|
- lib/rubycfn.rb
|
|
@@ -273,47 +272,59 @@ files:
|
|
|
273
272
|
- rubycfn.gemspec
|
|
274
273
|
- spec/lib/rubycfn_spec.rb
|
|
275
274
|
- spec/spec_helper.rb
|
|
276
|
-
- templates/.env
|
|
277
|
-
- templates/.env.
|
|
278
|
-
- templates/.env.rspec
|
|
279
|
-
- templates/.env.
|
|
280
|
-
- templates/.
|
|
281
|
-
- templates/.
|
|
282
|
-
- templates/.
|
|
283
|
-
- templates
|
|
284
|
-
- templates
|
|
285
|
-
- templates
|
|
286
|
-
- templates/
|
|
287
|
-
- templates/
|
|
288
|
-
- templates/
|
|
289
|
-
- templates/
|
|
290
|
-
- templates/
|
|
291
|
-
- templates/
|
|
292
|
-
- templates/
|
|
293
|
-
- templates/
|
|
294
|
-
- templates/
|
|
295
|
-
- templates/
|
|
296
|
-
- templates/
|
|
297
|
-
- templates/
|
|
298
|
-
- templates/
|
|
299
|
-
- templates/
|
|
300
|
-
- templates/
|
|
301
|
-
- templates/
|
|
302
|
-
- templates/
|
|
303
|
-
- templates/
|
|
304
|
-
- templates/
|
|
305
|
-
- templates/
|
|
306
|
-
- templates/
|
|
307
|
-
- templates/
|
|
308
|
-
- templates/
|
|
309
|
-
- templates/
|
|
310
|
-
- templates/
|
|
311
|
-
- templates/
|
|
275
|
+
- templates/.env
|
|
276
|
+
- templates/.env.acceptance
|
|
277
|
+
- templates/.env.dependencies.rspec
|
|
278
|
+
- templates/.env.development
|
|
279
|
+
- templates/.env.private
|
|
280
|
+
- templates/.env.production
|
|
281
|
+
- templates/.env.rspec
|
|
282
|
+
- templates/.env.test
|
|
283
|
+
- templates/.gitignore
|
|
284
|
+
- templates/.rubocop.yml
|
|
285
|
+
- templates/Gemfile
|
|
286
|
+
- templates/README.md
|
|
287
|
+
- templates/Rakefile
|
|
288
|
+
- templates/config.yaml
|
|
289
|
+
- templates/lib/aws_helper/aws_sdk.rb
|
|
290
|
+
- templates/lib/aws_helper/compiler.rb
|
|
291
|
+
- templates/lib/aws_helper/dependencies.rb
|
|
292
|
+
- templates/lib/aws_helper/deploy.rb
|
|
293
|
+
- templates/lib/aws_helper/helpers.rb
|
|
294
|
+
- templates/lib/aws_helper/main.rb
|
|
295
|
+
- templates/lib/aws_helper/upload_stack.rb
|
|
296
|
+
- templates/lib/core/applications.rb
|
|
297
|
+
- templates/lib/core/assume_role.rb
|
|
298
|
+
- templates/lib/core/classes.rb
|
|
299
|
+
- templates/lib/core/compile.rb
|
|
300
|
+
- templates/lib/core/dependencies.rb
|
|
301
|
+
- templates/lib/core/deploy.rb
|
|
302
|
+
- templates/lib/core/git.rb
|
|
303
|
+
- templates/lib/core/init.rb
|
|
304
|
+
- templates/lib/core/upload.rb
|
|
305
|
+
- templates/lib/main.rb
|
|
306
|
+
- templates/lib/shared_concerns/global_variables.rb
|
|
307
|
+
- templates/lib/shared_concerns/helper_functions.rb
|
|
308
|
+
- templates/lib/shared_concerns/helper_methods.rb
|
|
309
|
+
- templates/lib/shared_concerns/shared_methods.rb
|
|
310
|
+
- templates/lib/stacks/acm_stack/certificate_manager.rb
|
|
311
|
+
- templates/lib/stacks/acm_stack/main.rb
|
|
312
|
+
- templates/lib/stacks/ecs_stack/ecs_cluster.rb
|
|
313
|
+
- templates/lib/stacks/ecs_stack/lifecycle_hook.rb
|
|
314
|
+
- templates/lib/stacks/ecs_stack/load_balancer.rb
|
|
315
|
+
- templates/lib/stacks/ecs_stack/main.rb
|
|
316
|
+
- templates/lib/stacks/ecs_stack/rollback.rb
|
|
317
|
+
- templates/lib/stacks/parent_stack/main.rb
|
|
318
|
+
- templates/lib/stacks/parent_stack/parent.rb
|
|
319
|
+
- templates/lib/stacks/vpc_stack/infra_vpc.rb
|
|
320
|
+
- templates/lib/stacks/vpc_stack/main.rb
|
|
321
|
+
- templates/spec/lib/parent_spec.rb
|
|
322
|
+
- templates/spec/spec_helper.rb
|
|
312
323
|
homepage: https://github.com/dennisvink/rubycfn
|
|
313
324
|
licenses:
|
|
314
325
|
- MIT
|
|
315
326
|
metadata: {}
|
|
316
|
-
post_install_message:
|
|
327
|
+
post_install_message:
|
|
317
328
|
rdoc_options: []
|
|
318
329
|
require_paths:
|
|
319
330
|
- lib
|
|
@@ -328,17 +339,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
328
339
|
- !ruby/object:Gem::Version
|
|
329
340
|
version: '0'
|
|
330
341
|
requirements: []
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
signing_key:
|
|
342
|
+
rubygems_version: 3.1.2
|
|
343
|
+
signing_key:
|
|
334
344
|
specification_version: 4
|
|
335
345
|
summary: Rubycfn
|
|
336
346
|
test_files:
|
|
337
347
|
- rubycfn.gemspec
|
|
338
348
|
- spec/lib/rubycfn_spec.rb
|
|
339
349
|
- spec/spec_helper.rb
|
|
340
|
-
- templates/.env.rspec
|
|
341
|
-
- templates/.env.
|
|
342
|
-
- templates
|
|
343
|
-
- templates/
|
|
344
|
-
- templates/
|
|
350
|
+
- templates/.env.dependencies.rspec
|
|
351
|
+
- templates/.env.rspec
|
|
352
|
+
- templates/.env.test
|
|
353
|
+
- templates/spec/lib/parent_spec.rb
|
|
354
|
+
- templates/spec/spec_helper.rb
|
data/format.vim
DELETED
data/templates/.env.erb
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
# ENV vars for production environment
|
|
2
|
-
CLOUD_TRAIL_MONITOR_SNS_RECIPIENTS="changeme@example.com,changemetoo@example.com"
|
|
3
|
-
ROOT_MONITOR_SNS_RECIPIENTS="changeme@example.com,changemetoo@example.com"
|
|
4
|
-
VPC_CIDR_BLOCK="10.200.0.0/16"
|
|
5
|
-
ARTIFACT_BUCKET="my-awesome-cloudformation-artifact-bucket-for-production"
|
|
6
|
-
STACK_NAME="production"
|
data/templates/.env.rspec.erb
DELETED
data/templates/.env.test.erb
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
# ENV vars for test environment
|
|
2
|
-
CLOUD_TRAIL_MONITOR_SNS_RECIPIENTS="changeme@example.com,changemetoo@example.com"
|
|
3
|
-
ROOT_MONITOR_SNS_RECIPIENTS="changeme@example.com,changemetoo@example.com"
|
|
4
|
-
VPC_CIDR_BLOCK="10.100.0.0/16"
|
|
5
|
-
ARTIFACT_BUCKET="my-awesome-cloudformation-artifact-bucket"
|
|
6
|
-
STACK_NAME="test"
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
image: rubycfn/rubycfn:latest
|
|
2
|
-
|
|
3
|
-
before_script:
|
|
4
|
-
- bundle
|
|
5
|
-
|
|
6
|
-
variables:
|
|
7
|
-
CFN_ARTIFACT_BUCKET: "my-awesome-cloudformation-bucket"
|
|
8
|
-
STAGING_AWS_REGION: eu-west-1
|
|
9
|
-
PROD_AWS_REGION: eu-west-1
|
|
10
|
-
|
|
11
|
-
stages:
|
|
12
|
-
- build
|
|
13
|
-
- test
|
|
14
|
-
- upload
|
|
15
|
-
- staging
|
|
16
|
-
- production
|
|
17
|
-
|
|
18
|
-
build:
|
|
19
|
-
stage: build
|
|
20
|
-
variables:
|
|
21
|
-
ARTIFACT_BUCKET: ${CFN_ARTIFACT_BUCKET}
|
|
22
|
-
script:
|
|
23
|
-
- export SLACK_WEBHOOK=$K8S_SECRET_SLACK_POST_HOOK
|
|
24
|
-
- ENVIRONMENT="test" rake compile
|
|
25
|
-
- ENVIRONMENT="production" rake compile
|
|
26
|
-
- rubocop
|
|
27
|
-
- cfn_nag_scan --input-path build/ || true
|
|
28
|
-
artifacts:
|
|
29
|
-
paths:
|
|
30
|
-
- build/
|
|
31
|
-
|
|
32
|
-
test:
|
|
33
|
-
stage: test
|
|
34
|
-
script:
|
|
35
|
-
- rake spec
|
|
36
|
-
dependencies:
|
|
37
|
-
- build
|
|
38
|
-
|
|
39
|
-
upload:
|
|
40
|
-
stage: upload
|
|
41
|
-
variables:
|
|
42
|
-
ARTIFACT_BUCKET: ${CFN_ARTIFACT_BUCKET}
|
|
43
|
-
AWS_REGION: ${STAGING_AWS_REGION}
|
|
44
|
-
script:
|
|
45
|
-
- export AWS_SECRET_ACCESS_KEY=$K8S_SECRET_AWS_SECRET_ACCESS_KEY
|
|
46
|
-
- export AWS_ACCESS_KEY_ID=$K8S_SECRET_AWS_ACCESS_KEY_ID
|
|
47
|
-
- ENVIRONMENT="test" rake upload
|
|
48
|
-
- ENVIRONMENT="production" rake upload
|
|
49
|
-
|
|
50
|
-
deploy_staging:
|
|
51
|
-
stage: staging
|
|
52
|
-
variables:
|
|
53
|
-
ARTIFACT_BUCKET: ${CFN_ARTIFACT_BUCKET}
|
|
54
|
-
AWS_REGION: ${STAGING_AWS_REGION}
|
|
55
|
-
script:
|
|
56
|
-
- export AWS_SECRET_ACCESS_KEY=$K8S_SECRET_AWS_SECRET_ACCESS_KEY
|
|
57
|
-
- export AWS_ACCESS_KEY_ID=$K8S_SECRET_AWS_ACCESS_KEY_ID
|
|
58
|
-
- export ENVIRONMENT="test"
|
|
59
|
-
- rake apply
|
|
60
|
-
allow_failure: false
|
|
61
|
-
|
|
62
|
-
deploy_prod:
|
|
63
|
-
stage: production
|
|
64
|
-
variables:
|
|
65
|
-
ARTIFACT_BUCKET: ${CFN_ARTIFACT_BUCKET}
|
|
66
|
-
AWS_REGION: ${PROD_AWS_REGION}
|
|
67
|
-
script:
|
|
68
|
-
- export AWS_SECRET_ACCESS_KEY=$K8S_SECRET_AWS_SECRET_ACCESS_KEY
|
|
69
|
-
- export AWS_ACCESS_KEY_ID=$K8S_SECRET_AWS_ACCESS_KEY_ID
|
|
70
|
-
- export ENVIRONMENT="production"
|
|
71
|
-
- rake apply
|
|
72
|
-
dependencies:
|
|
73
|
-
- deploy_staging
|
|
74
|
-
when: manual
|
|
75
|
-
allow_failure: false
|
data/templates/aws_sdk.rb.erb
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
def create_bucket_if_not_exists(aws_region, artifact_bucket)
|
|
2
|
-
s3 = Aws::S3::Resource.new(region: aws_region)
|
|
3
|
-
begin
|
|
4
|
-
s3.create_bucket(bucket: artifact_bucket)
|
|
5
|
-
rescue => exception
|
|
6
|
-
raise exception unless exception.class == Aws::S3::Errors::BucketAlreadyOwnedByYou
|
|
7
|
-
end
|
|
8
|
-
s3
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def set_aws_credentials(region, access_key_id, secret_access_key)
|
|
12
|
-
Aws.config.update(
|
|
13
|
-
region: region,
|
|
14
|
-
credentials: Aws::Credentials.new(
|
|
15
|
-
access_key_id, secret_access_key
|
|
16
|
-
)
|
|
17
|
-
)
|
|
18
|
-
end
|
data/templates/core_diff.rb.erb
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
require "diffy"
|
|
2
|
-
require_relative "../aws_helper/main"
|
|
3
|
-
|
|
4
|
-
env_vars = load_env_vars
|
|
5
|
-
|
|
6
|
-
set_aws_credentials(
|
|
7
|
-
env_vars[:aws_region],
|
|
8
|
-
env_vars[:aws_access_key_id],
|
|
9
|
-
env_vars[:aws_secret_access_key]
|
|
10
|
-
)
|
|
11
|
-
|
|
12
|
-
client = Aws::CloudFormation::Client.new
|
|
13
|
-
template = client.get_template(
|
|
14
|
-
stack_name: "#{ENV["ENVIRONMENT"]}-#{ENV["PROJECT_NAME"]}"
|
|
15
|
-
)
|
|
16
|
-
|
|
17
|
-
s3 = Aws::S3::Resource.new(region: env_vars[:aws_region])
|
|
18
|
-
orig_template = {}
|
|
19
|
-
|
|
20
|
-
template = JSON.parse(template.template_body)
|
|
21
|
-
template["Resources"].each do |resource_name, content|
|
|
22
|
-
if content["Type"] == "AWS::CloudFormation::Stack"
|
|
23
|
-
stack_name = "#{ENV["PROJECT_NAME"].capitalize}Stack"
|
|
24
|
-
orig_template[stack_name] = JSON.pretty_generate(
|
|
25
|
-
JSON.parse(
|
|
26
|
-
template.to_json
|
|
27
|
-
)
|
|
28
|
-
)
|
|
29
|
-
end
|
|
30
|
-
next unless content["Type"] == "AWS::CloudFormation::Stack"
|
|
31
|
-
s3_filename = content["Properties"]["TemplateURL"].split("/").last
|
|
32
|
-
orig_template[resource_name] = JSON.pretty_generate(
|
|
33
|
-
JSON.parse(
|
|
34
|
-
s3.client.get_object(
|
|
35
|
-
bucket: env_vars[:artifact_bucket],
|
|
36
|
-
key: s3_filename
|
|
37
|
-
).body.read
|
|
38
|
-
)
|
|
39
|
-
)
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
stacks = compile_stacks(true)
|
|
43
|
-
@stack_hashes.each do |stack_name, _hash|
|
|
44
|
-
new_template = JSON.pretty_generate(
|
|
45
|
-
JSON.parse(
|
|
46
|
-
stacks[stack_name]
|
|
47
|
-
)
|
|
48
|
-
)
|
|
49
|
-
diff = Diffy::Diff.new(
|
|
50
|
-
orig_template[stack_name.to_s], new_template
|
|
51
|
-
).to_s(:color)
|
|
52
|
-
|
|
53
|
-
if diff.strip.empty?
|
|
54
|
-
puts "No difference between local #{stack_name} and remote #{stack_name}"
|
|
55
|
-
else
|
|
56
|
-
puts "Orig #{stack_name} vs #{stack_name}:"
|
|
57
|
-
puts diff
|
|
58
|
-
end
|
|
59
|
-
end
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
def load_env_vars
|
|
2
|
-
Dotenv.load(".env")
|
|
3
|
-
Dotenv.load(".env.#{ENV["ENVIRONMENT"]}")
|
|
4
|
-
Dotenv.load(".env.private")
|
|
5
|
-
check_dependencies
|
|
6
|
-
{
|
|
7
|
-
aws_region: ENV["AWS_REGION"],
|
|
8
|
-
aws_access_key_id: ENV["AWS_ACCESS_KEY_ID"],
|
|
9
|
-
aws_secret_access_key: ENV["AWS_SECRET_ACCESS_KEY"],
|
|
10
|
-
artifact_bucket: ENV["ARTIFACT_BUCKET"],
|
|
11
|
-
environment: ENV["ENVIRONMENT"],
|
|
12
|
-
stack_name: ENV["STACK_NAME"]
|
|
13
|
-
}
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def check_dependencies
|
|
17
|
-
ENV["AWS_REGION"] ||= ENV["AWS_DEFAULT_REGION"]
|
|
18
|
-
raise "AWS_REGION not set" unless ENV["AWS_REGION"]
|
|
19
|
-
raise "ARTIFACT_BUCKET not set" unless ENV["ARTIFACT_BUCKET"]
|
|
20
|
-
raise "ENVIRONMENT not set" unless ENV["ENVIRONMENT"]
|
|
21
|
-
raise "STACK_NAME not set" unless ENV["STACK_NAME"]
|
|
22
|
-
raise "AWS CREDENTIALS NOT SET" unless ENV["AWS_ACCESS_KEY_ID"] && ENV["AWS_SECRET_ACCESS_KEY"]
|
|
23
|
-
end
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
module EcsStack
|
|
2
|
-
module EcsCluster
|
|
3
|
-
extend ActiveSupport::Concern
|
|
4
|
-
|
|
5
|
-
included do
|
|
6
|
-
transform
|
|
7
|
-
parameter :vpc,
|
|
8
|
-
description: "VPC ID"
|
|
9
|
-
|
|
10
|
-
# Create an empty ECS Cluster to launch fargate bastions (or other things) in
|
|
11
|
-
resource :<%= name.downcase %>_ecs_cluster,
|
|
12
|
-
type: "AWS::ECS::Cluster"
|
|
13
|
-
|
|
14
|
-
output :<%= name.downcase %>_ecs_cluster,
|
|
15
|
-
value: "<%= name %>EcsCluster".ref
|
|
16
|
-
output :<%= name.downcase %>_ecs_cluster_arn,
|
|
17
|
-
value: "<%= name.downcase %>EcsCluster".ref("Arn")
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|