stack_master 1.7.2-x64-mingw32 → 1.8.0-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -0
- data/lib/stack_master.rb +10 -6
- data/lib/stack_master/cli.rb +22 -0
- data/lib/stack_master/commands/compile.rb +27 -0
- data/lib/stack_master/commands/lint.rb +42 -0
- data/lib/stack_master/parameter_resolvers/acm_certificate.rb +37 -0
- data/lib/stack_master/version.rb +1 -1
- metadata +19 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94aab9979b48015c316ca47e533b627a463be5e8
|
4
|
+
data.tar.gz: 43e8fa27e5b181c06d40313232452056675f3562
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf4539eb97c8c07ec1238bc94f53250c9401dac6916ba11dff28916bc6dcc94996e7251ec9f77c11108a05f5ccca0c5b447761bbf42f31a95bd0bdb3dc7dca0a
|
7
|
+
data.tar.gz: 32299dfe9da9e509a07cc3bc11858f6c44956b66172b96d0fdf0a7c60899ebc912b8de124856f72b13753454d2e5f38353820c809af7b7867ee51e474cb5883a
|
data/README.md
CHANGED
@@ -340,6 +340,15 @@ db_username:
|
|
340
340
|
env: DB_USERNAME
|
341
341
|
```
|
342
342
|
|
343
|
+
### ACM Certificates
|
344
|
+
|
345
|
+
Find an ACM certificate by domain name:
|
346
|
+
|
347
|
+
```yaml
|
348
|
+
cert:
|
349
|
+
acm_certificate: www.example.com
|
350
|
+
```
|
351
|
+
|
343
352
|
### Custom parameter resolvers
|
344
353
|
|
345
354
|
New parameter resolvers can be created in a separate gem.
|
data/lib/stack_master.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
require 'commander'
|
2
2
|
require 'yaml'
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
3
|
+
require 'aws-sdk-acm'
|
4
|
+
require 'aws-sdk-cloudformation'
|
5
|
+
require 'aws-sdk-ec2'
|
6
|
+
require 'aws-sdk-s3'
|
7
|
+
require 'aws-sdk-sns'
|
8
|
+
require 'aws-sdk-ssm'
|
9
|
+
require 'colorize'
|
9
10
|
require 'active_support/core_ext/string'
|
10
11
|
require 'multi_json'
|
11
12
|
|
@@ -54,12 +55,15 @@ module StackMaster
|
|
54
55
|
autoload :Diff, 'stack_master/commands/diff'
|
55
56
|
autoload :ListStacks, 'stack_master/commands/list_stacks'
|
56
57
|
autoload :Validate, 'stack_master/commands/validate'
|
58
|
+
autoload :Lint, 'stack_master/commands/lint'
|
59
|
+
autoload :Compile, 'stack_master/commands/compile'
|
57
60
|
autoload :Resources, 'stack_master/commands/resources'
|
58
61
|
autoload :Delete, 'stack_master/commands/delete'
|
59
62
|
autoload :Status, 'stack_master/commands/status'
|
60
63
|
end
|
61
64
|
|
62
65
|
module ParameterResolvers
|
66
|
+
autoload :AcmCertificate, 'stack_master/parameter_resolvers/acm_certificate'
|
63
67
|
autoload :AmiFinder, 'stack_master/parameter_resolvers/ami_finder'
|
64
68
|
autoload :StackOutput, 'stack_master/parameter_resolvers/stack_output'
|
65
69
|
autoload :Secret, 'stack_master/parameter_resolvers/secret'
|
data/lib/stack_master/cli.rb
CHANGED
@@ -131,6 +131,28 @@ module StackMaster
|
|
131
131
|
end
|
132
132
|
end
|
133
133
|
|
134
|
+
command :lint do |c|
|
135
|
+
c.syntax = 'stack_master lint [region_or_alias] [stack_name]'
|
136
|
+
c.summary = "Check the stack definition locally"
|
137
|
+
c.description = "Runs cfn-lint on the template which would be sent to AWS on apply"
|
138
|
+
c.example 'run cfn-lint on stack myapp-vpc with us-east-1 settings', 'stack_master lint us-east-1 myapp-vpc'
|
139
|
+
c.action do |args, options|
|
140
|
+
options.defaults config: default_config_file
|
141
|
+
execute_stacks_command(StackMaster::Commands::Lint, args, options)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
command :compile do |c|
|
146
|
+
c.syntax = 'stack_master compile [region_or_alias] [stack_name]'
|
147
|
+
c.summary = "Print the compiled version of a given stack"
|
148
|
+
c.description = "Processes the stack and prints out a compiled version - same we'd send to AWS"
|
149
|
+
c.example 'print compiled stack myapp-vpc with us-east-1 settings', 'stack_master compile us-east-1 myapp-vpc'
|
150
|
+
c.action do |args, options|
|
151
|
+
options.defaults config: default_config_file
|
152
|
+
execute_stacks_command(StackMaster::Commands::Compile, args, options)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
134
156
|
command :status do |c|
|
135
157
|
c.syntax = 'stack_master status'
|
136
158
|
c.summary = 'Check the current status stacks.'
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module StackMaster
|
2
|
+
module Commands
|
3
|
+
class Compile
|
4
|
+
include Command
|
5
|
+
include Commander::UI
|
6
|
+
|
7
|
+
def initialize(config, stack_definition, options = {})
|
8
|
+
@config = config
|
9
|
+
@stack_definition = stack_definition
|
10
|
+
end
|
11
|
+
|
12
|
+
def perform
|
13
|
+
puts(proposed_stack.template_body)
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def stack_definition
|
19
|
+
@stack_definition ||= @config.find_stack(@region, @stack_name)
|
20
|
+
end
|
21
|
+
|
22
|
+
def proposed_stack
|
23
|
+
@proposed_stack ||= Stack.generate(stack_definition, @config)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'tempfile'
|
2
|
+
|
3
|
+
module StackMaster
|
4
|
+
module Commands
|
5
|
+
class Lint
|
6
|
+
include Command
|
7
|
+
include Commander::UI
|
8
|
+
|
9
|
+
def initialize(config, stack_definition, options = {})
|
10
|
+
@config = config
|
11
|
+
@stack_definition = stack_definition
|
12
|
+
end
|
13
|
+
|
14
|
+
def perform
|
15
|
+
unless cfn_lint_available
|
16
|
+
failed! "Failed to run cfn-lint, do you have it installed and available in $PATH?"
|
17
|
+
end
|
18
|
+
|
19
|
+
Tempfile.open(['stack', ".#{proposed_stack.template_format}"]) do |f|
|
20
|
+
f.write(proposed_stack.template_body)
|
21
|
+
f.flush
|
22
|
+
system('cfn-lint', f.path)
|
23
|
+
puts "cfn-lint run complete"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def stack_definition
|
30
|
+
@stack_definition ||= @config.find_stack(@region, @stack_name)
|
31
|
+
end
|
32
|
+
|
33
|
+
def proposed_stack
|
34
|
+
@proposed_stack ||= Stack.generate(stack_definition, @config)
|
35
|
+
end
|
36
|
+
|
37
|
+
def cfn_lint_available
|
38
|
+
!system('cfn-lint', '--version').nil?
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module StackMaster
|
2
|
+
module ParameterResolvers
|
3
|
+
class AcmCertificate < Resolver
|
4
|
+
CertificateNotFound = Class.new(StandardError)
|
5
|
+
|
6
|
+
def initialize(config, stack_definition)
|
7
|
+
@config = config
|
8
|
+
@stack_definition = stack_definition
|
9
|
+
end
|
10
|
+
|
11
|
+
def resolve(domain_name)
|
12
|
+
cert_arn = find_cert_arn_by_domain_name(domain_name)
|
13
|
+
raise CertificateNotFound, "Could not find certificate #{domain_name} in #{@stack_definition.region}" unless cert_arn
|
14
|
+
cert_arn
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def all_certs
|
20
|
+
certs = []
|
21
|
+
next_token = nil
|
22
|
+
client = Aws::ACM::Client.new(region: @stack_definition.region)
|
23
|
+
loop do
|
24
|
+
resp = client.list_certificates(certificate_statuses: ['ISSUED'], next_token: next_token)
|
25
|
+
certs << resp.certificate_summary_list
|
26
|
+
next_token = resp.next_token
|
27
|
+
break if next_token.nil?
|
28
|
+
end
|
29
|
+
certs.flatten
|
30
|
+
end
|
31
|
+
|
32
|
+
def find_cert_arn_by_domain_name(domain_name)
|
33
|
+
all_certs.map { |c| c.certificate_arn if c.domain_name == domain_name }.compact.first
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/lib/stack_master/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stack_master
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.0
|
5
5
|
platform: x64-mingw32
|
6
6
|
authors:
|
7
7
|
- Steve Hodgkiss
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-07-
|
12
|
+
date: 2018-07-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -151,6 +151,20 @@ dependencies:
|
|
151
151
|
- - ">="
|
152
152
|
- !ruby/object:Gem::Version
|
153
153
|
version: '0'
|
154
|
+
- !ruby/object:Gem::Dependency
|
155
|
+
name: aws-sdk-acm
|
156
|
+
requirement: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - "~>"
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '1'
|
161
|
+
type: :runtime
|
162
|
+
prerelease: false
|
163
|
+
version_requirements: !ruby/object:Gem::Requirement
|
164
|
+
requirements:
|
165
|
+
- - "~>"
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: '1'
|
154
168
|
- !ruby/object:Gem::Dependency
|
155
169
|
name: aws-sdk-cloudformation
|
156
170
|
requirement: !ruby/object:Gem::Requirement
|
@@ -379,10 +393,12 @@ files:
|
|
379
393
|
- lib/stack_master/cli.rb
|
380
394
|
- lib/stack_master/command.rb
|
381
395
|
- lib/stack_master/commands/apply.rb
|
396
|
+
- lib/stack_master/commands/compile.rb
|
382
397
|
- lib/stack_master/commands/delete.rb
|
383
398
|
- lib/stack_master/commands/diff.rb
|
384
399
|
- lib/stack_master/commands/events.rb
|
385
400
|
- lib/stack_master/commands/init.rb
|
401
|
+
- lib/stack_master/commands/lint.rb
|
386
402
|
- lib/stack_master/commands/list_stacks.rb
|
387
403
|
- lib/stack_master/commands/outputs.rb
|
388
404
|
- lib/stack_master/commands/resources.rb
|
@@ -394,6 +410,7 @@ files:
|
|
394
410
|
- lib/stack_master/paged_response_accumulator.rb
|
395
411
|
- lib/stack_master/parameter_loader.rb
|
396
412
|
- lib/stack_master/parameter_resolver.rb
|
413
|
+
- lib/stack_master/parameter_resolvers/acm_certificate.rb
|
397
414
|
- lib/stack_master/parameter_resolvers/ami_finder.rb
|
398
415
|
- lib/stack_master/parameter_resolvers/env.rb
|
399
416
|
- lib/stack_master/parameter_resolvers/latest_ami.rb
|