cfndslhelper 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +20 -0
- data/.rspec +2 -0
- data/GEM-README.md +46 -0
- data/Gemfile +7 -0
- data/LICENSE.txt +21 -0
- data/README.MD +33 -0
- data/Rakefile +6 -0
- data/bin/cfndslhelper +5 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/cfndslhelper.gemspec +30 -0
- data/lib/cfndslhelper.rb +11 -0
- data/lib/cfndslhelper/cli.rb +334 -0
- data/lib/cfndslhelper/ext.rb +3 -0
- data/lib/cfndslhelper/generate.rb +12 -0
- data/lib/cfndslhelper/version.rb +3 -0
- metadata +131 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 461f46748889f6a93df119752666ac7ddd4c7e705cdfa0dc6b38a391bcfd1277
|
4
|
+
data.tar.gz: 6cddb2544e762707aaf77aad120cb201fa09d86f0ab54d5ead36250c8740e7f6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 53601e88de46cb88f5daee563989350a0a0104a40bb21f7180ae0e404f778b2fb69d10656a2e7573fe9c2cc1062a3dcd693a4c9a97a022166270f01b45283d48
|
7
|
+
data.tar.gz: 234e2cbe29c133c1d1fa7a5faeee83ef0de833b8a66a81ba420eef916181d82e54ade04eb85a17a6fde12be67cda8d351361d5472d1ef8b4516dbad27a6be153
|
data/.gitignore
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/Gemfile.lock
|
4
|
+
/_yardoc/
|
5
|
+
/coverage/
|
6
|
+
/doc/
|
7
|
+
/pkg/
|
8
|
+
/spec/reports/
|
9
|
+
/tmp/
|
10
|
+
/test/stack/output/*.json
|
11
|
+
*.gem
|
12
|
+
*~
|
13
|
+
Gemfile.lock
|
14
|
+
tmp/
|
15
|
+
coverage/
|
16
|
+
*.swp
|
17
|
+
*.swo
|
18
|
+
build.properties
|
19
|
+
bin/build
|
20
|
+
todo
|
data/.rspec
ADDED
data/GEM-README.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# Cfndslhelper
|
2
|
+
|
3
|
+
A gem that helps with cfndsl.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'cfndslhelper'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install cfndslhelper
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
```
|
24
|
+
cfndslhelper generate
|
25
|
+
|
26
|
+
cfndslhelper validate
|
27
|
+
|
28
|
+
cfndslhelper upload
|
29
|
+
|
30
|
+
cfndslhelper create -s somestack -p x=y,z=2
|
31
|
+
|
32
|
+
cfndslhelper update -s somestack
|
33
|
+
```
|
34
|
+
|
35
|
+
## Development
|
36
|
+
|
37
|
+
|
38
|
+
## Contributing
|
39
|
+
|
40
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/daraghmartin/cfndslhelper.
|
41
|
+
|
42
|
+
|
43
|
+
## License
|
44
|
+
|
45
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
46
|
+
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Daragh Martin
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.MD
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# Cfndslhelper
|
2
|
+
|
3
|
+
A gem that helps with cfndsl.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'cfndslhelper'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install cfndslhelper
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
```
|
24
|
+
cfndslhelper generate
|
25
|
+
|
26
|
+
cfndslhelper validate
|
27
|
+
|
28
|
+
cfndslhelper upload
|
29
|
+
|
30
|
+
cfndslhelper create -s somestack -p x=y,z=2
|
31
|
+
|
32
|
+
cfndslhelper update -s somestack
|
33
|
+
```
|
data/Rakefile
ADDED
data/bin/cfndslhelper
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'cfndslhelper'
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require 'pry'
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require 'irb'
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'cfndslhelper/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'cfndslhelper'
|
8
|
+
spec.version = CfnDSLHelper::VERSION
|
9
|
+
spec.authors = ['Daragh Martin']
|
10
|
+
spec.email = ["daragh.martin@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Helper to provide functionality for developing with cfndsl}
|
13
|
+
spec.description = %q{Write a longer description or delete this line.}
|
14
|
+
spec.homepage = 'https://github.com/daraghmartin/cfndslhelper'
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
spec.bindir = "bin"
|
21
|
+
#spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.executables << 'cfndslhelper'
|
23
|
+
spec.require_paths = ['lib']
|
24
|
+
|
25
|
+
spec.add_development_dependency 'bundler', '~> 1.13'
|
26
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
27
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
28
|
+
spec.add_runtime_dependency 'aws-sdk'
|
29
|
+
spec.add_runtime_dependency 'cfndsl'
|
30
|
+
end
|
data/lib/cfndslhelper.rb
ADDED
@@ -0,0 +1,334 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'cfndsl'
|
4
|
+
require 'aws-sdk'
|
5
|
+
require 'json'
|
6
|
+
require 'trollop'
|
7
|
+
|
8
|
+
module CfnDSLHelper
|
9
|
+
class Cli
|
10
|
+
def initialize(argv, stdin=STDIN, stdout=STDOUT, stderr=STDERR, kernel=Kernel)
|
11
|
+
@argv, @stdin, @stdout, @stderr, @kernel = argv, stdin, stdout, stderr, kernel
|
12
|
+
end
|
13
|
+
|
14
|
+
def execute!
|
15
|
+
instruction = @argv.first
|
16
|
+
puts "#CfnDSLHelperVERSION:#{CfnDSLHelper::VERSION}"
|
17
|
+
get_config unless instruction == 'parameter-update'
|
18
|
+
|
19
|
+
if instruction == 'generate'
|
20
|
+
generate
|
21
|
+
end
|
22
|
+
|
23
|
+
if instruction == 'validate'
|
24
|
+
validate
|
25
|
+
end
|
26
|
+
|
27
|
+
if instruction == 'upload'
|
28
|
+
upload
|
29
|
+
end
|
30
|
+
|
31
|
+
if instruction == 'create'
|
32
|
+
create
|
33
|
+
end
|
34
|
+
|
35
|
+
if instruction == 'delete'
|
36
|
+
delete
|
37
|
+
end
|
38
|
+
|
39
|
+
if instruction == 'update'
|
40
|
+
update
|
41
|
+
end
|
42
|
+
|
43
|
+
if instruction == 'show-events'
|
44
|
+
show_events
|
45
|
+
end
|
46
|
+
|
47
|
+
if instruction == 'parameter-update'
|
48
|
+
parameter_only_update
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def get_config
|
53
|
+
@base_dir = ENV['CFN_BASE_DIR'] || Dir.pwd
|
54
|
+
|
55
|
+
puts @base_dir
|
56
|
+
|
57
|
+
@config = {}
|
58
|
+
|
59
|
+
@extras = []
|
60
|
+
|
61
|
+
config_location = ENV['CFN_CONFIG_LOCATION'] || "#{@base_dir}/config/project_config.yml"
|
62
|
+
|
63
|
+
notifications_location = ENV['CFN_NOTIFICATIONS_LOCATION'] || "#{@base_dir}/config/notifications.yml"
|
64
|
+
|
65
|
+
@config = YAML.load_file(config_location)
|
66
|
+
|
67
|
+
if File.file? notifications_location
|
68
|
+
@config.merge!(YAML.load_file(notifications_location))
|
69
|
+
end
|
70
|
+
|
71
|
+
parse_args
|
72
|
+
|
73
|
+
if ENV['CFN_VERSION']
|
74
|
+
@config['version'] = ENV['CFN_VERSION']
|
75
|
+
File.write("#{@base_dir}/config/version.yml", "version: \"#{ENV['CFN_VERSION']}\"")
|
76
|
+
end
|
77
|
+
|
78
|
+
@config['region'] = @config['region'] || 'ap-southeast-2'
|
79
|
+
|
80
|
+
%w[version pplication_name project].each do | requirement |
|
81
|
+
raise "No #{requirement} specified" unless @config[requirement]
|
82
|
+
end
|
83
|
+
|
84
|
+
@cfn_templates = Dir["#{@base_dir}/cfndsl/**/*.rb"]
|
85
|
+
|
86
|
+
if File.directory? "#{@base_dir}/cfndsl-imports"
|
87
|
+
@cfn_templates += Dir["#{@base_dir}/cfndsl-imports/**/*.rb"]
|
88
|
+
end
|
89
|
+
|
90
|
+
Dir["#{@base_dir}/config/*.yml"].each do | extra |
|
91
|
+
@extras << [:yaml, extra]
|
92
|
+
end
|
93
|
+
|
94
|
+
Dir["#{@base_dir}/config/*.rb"].each do | extra |
|
95
|
+
@extras << [:ruby, extra]
|
96
|
+
end
|
97
|
+
|
98
|
+
if ENV['STACK_NAME']
|
99
|
+
@config['stack_name'] = @config['stack_name'] || ENV['STACK_NAME']
|
100
|
+
end
|
101
|
+
|
102
|
+
puts @config
|
103
|
+
end
|
104
|
+
|
105
|
+
def get_config_no_files
|
106
|
+
@config = {}
|
107
|
+
parse_args
|
108
|
+
@config['stack_name'] = @config['stack_name'] || ENV['STACK_NAME']
|
109
|
+
@config['region'] = @config['region'] || ENV['AWS_DEFAULT_REGION'] || 'ap-southeast-2'
|
110
|
+
puts @config
|
111
|
+
end
|
112
|
+
|
113
|
+
def parse_args
|
114
|
+
options = Trollop::options do
|
115
|
+
opt :stack_name, "whats the name of the stack??", type: String, short: "-s"
|
116
|
+
opt :parameters, "specify some parameters for create-ing or overriding k=v,k1=v1", type: String, short: "-p"
|
117
|
+
end
|
118
|
+
|
119
|
+
@config = options.merge @config
|
120
|
+
end
|
121
|
+
|
122
|
+
def generate
|
123
|
+
FileUtils.rm_rf Dir.glob("#{@base_dir}/output/**/*.json")
|
124
|
+
FileUtils.rm_rf Dir.glob("#{@base_dir}/output/**/*.yml")
|
125
|
+
|
126
|
+
if File.directory? "#{@base_dir}/raw-imports"
|
127
|
+
FileUtils.cp_r Dir.glob("#{@base_dir}/raw-imports/**/*.json"), "#{@base_dir}/output/"
|
128
|
+
FileUtils.cp_r Dir.glob("#{@base_dir}/raw-imports/**/*.yml"), "#{@base_dir}/output/"
|
129
|
+
end
|
130
|
+
|
131
|
+
@cfn_templates.each do |cfn_template|
|
132
|
+
puts cfn_template
|
133
|
+
filename = cfn_template
|
134
|
+
template = cfn_template.gsub(/.*\//, '')
|
135
|
+
output = template.gsub(/.rb$/,'.json')
|
136
|
+
puts '#BEGIN MODEL GENERATE'
|
137
|
+
model = CfnDsl.eval_file_with_extras(filename, @extras, verbose)
|
138
|
+
|
139
|
+
File.open("#{@base_dir}/output/#{output}", "w") do | f |
|
140
|
+
f.write(JSON.pretty_generate(model))
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
def validate
|
146
|
+
cfn = Aws::CloudFormation::Client.new(region: @config['region'])
|
147
|
+
|
148
|
+
Dir.glob("#{@base_dir}/output/*.json").each do | template |
|
149
|
+
puts "will validate #{template}"
|
150
|
+
body = File.read(template)
|
151
|
+
|
152
|
+
resp = cfn.validate_template(
|
153
|
+
template_body: body
|
154
|
+
)
|
155
|
+
puts resp
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
def upload
|
160
|
+
s3 = Aws::S3::Resource.new(region: @config['source_region'])
|
161
|
+
Dir.glob("#{@base_dir}/output/*.json").each do | template |
|
162
|
+
puts "will upload #{template}"
|
163
|
+
key = template.gsub(/.*\//, '')
|
164
|
+
key = "cloudformation/#{@config['project']}/#{@config['application_name']}/#{@config['version']}/#{key}"
|
165
|
+
puts "will upload #{template} to #{key}"
|
166
|
+
obj = s3.bucket(@config['source_bucket']).object(key)
|
167
|
+
obj.upload_file(template)
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
def get_parameters_to_array
|
172
|
+
parameters = []
|
173
|
+
if @config[:parameters_given]
|
174
|
+
@config[:parameters].split(',').each { | p | interim = p.split('='); parameters << { parameter_key: interim[0], parameter_value: interim[1] } }
|
175
|
+
end
|
176
|
+
|
177
|
+
parameters
|
178
|
+
end
|
179
|
+
|
180
|
+
# https://docs.aws.amazon.com/sdkforruby/api/Aws/CloudFormation/Client.html#create_stack-instance_method
|
181
|
+
def create
|
182
|
+
puts @config['region']
|
183
|
+
cfn = Aws::CloudFormation::Client.new(region: @config['region'])
|
184
|
+
|
185
|
+
parameters = get_parameters_to_array
|
186
|
+
puts parameters
|
187
|
+
|
188
|
+
stack = {
|
189
|
+
stack_name: @config[:stack_name],
|
190
|
+
template_url: template_url,
|
191
|
+
parameters: parameters,
|
192
|
+
notification_arns: @config['notification_arns'],
|
193
|
+
capabilities: ['CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM'],
|
194
|
+
tags: []
|
195
|
+
}
|
196
|
+
|
197
|
+
if @config[:set_stack_as_name_tag]
|
198
|
+
stack[:tags] << { key: 'Name', value: @config[:stack_name]}
|
199
|
+
end
|
200
|
+
|
201
|
+
puts stack
|
202
|
+
|
203
|
+
resp = cfn.create_stack(stack)
|
204
|
+
|
205
|
+
puts resp
|
206
|
+
|
207
|
+
stack_wait :stack_create_complete, {stack_name: @config[:stack_name] }
|
208
|
+
end
|
209
|
+
|
210
|
+
def delete
|
211
|
+
cfn = Aws::CloudFormation::Client.new(region: @config['region'])
|
212
|
+
resp = cfn.delete_stack({stack_name: @config[:stack_name]})
|
213
|
+
puts resp
|
214
|
+
|
215
|
+
stack_wait :stack_delete_complete, {stack_name: @config[:stack_name] }
|
216
|
+
end
|
217
|
+
|
218
|
+
def get_update_parameters(stack)
|
219
|
+
update_parameters = []
|
220
|
+
stack.parameters.each { |sp| update_parameters << sp.to_hash }
|
221
|
+
|
222
|
+
override_parameters = get_parameters_to_array
|
223
|
+
puts override_parameters
|
224
|
+
|
225
|
+
override_parameters.each do | parameter |
|
226
|
+
puts parameter
|
227
|
+
if update_parameters.detect { | up | up[:parameter_key] == parameter[:parameter_key] }
|
228
|
+
update_parameters.each { | up | up[:parameter_value] = parameter[:parameter_value] if up[:parameter_key] == parameter[:parameter_key] }
|
229
|
+
else
|
230
|
+
puts "#{parameter} not found in current parameters for stack"
|
231
|
+
update_parameters << { parameter_key: parameter[:parameter_key], parameter_value: parameter[:parameter_value] }
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
update_parameters.each { |x| p x }
|
236
|
+
end
|
237
|
+
|
238
|
+
def parameter_only_update
|
239
|
+
get_config_no_files
|
240
|
+
cfn = Aws::CloudFormation::Client.new(region: @config['region'])
|
241
|
+
|
242
|
+
stack = cfn.describe_stacks({stack_name: @config[:stack_name]}).stacks[0]
|
243
|
+
update_parameters = get_update_parameters(stack)
|
244
|
+
|
245
|
+
puts update_parameters
|
246
|
+
|
247
|
+
update_hash = {
|
248
|
+
stack_name: @config[:stack_name],
|
249
|
+
parameters: update_parameters,
|
250
|
+
notification_arns: @config['notification_arns'],
|
251
|
+
use_previous_template: true,
|
252
|
+
capabilities: ["CAPABILITY_NAMED_IAM"],
|
253
|
+
tags: []
|
254
|
+
}
|
255
|
+
|
256
|
+
if @config[:set_stack_as_name_tag]
|
257
|
+
update_hash[:tags] << { key: 'Name', value: @config[:stack_name]}
|
258
|
+
end
|
259
|
+
|
260
|
+
run_update update_hash
|
261
|
+
end
|
262
|
+
|
263
|
+
def update
|
264
|
+
cfn = Aws::CloudFormation::Client.new(region: @config['region'])
|
265
|
+
|
266
|
+
stack = cfn.describe_stacks({stack_name: @config[:stack_name]}).stacks[0]
|
267
|
+
update_parameters = get_update_parameters(stack)
|
268
|
+
|
269
|
+
puts update_parameters
|
270
|
+
|
271
|
+
update_hash = {
|
272
|
+
stack_name: @config[:stack_name],
|
273
|
+
template_url: template_url,
|
274
|
+
parameters: update_parameters,
|
275
|
+
notification_arns: @config['notification_arns'],
|
276
|
+
capabilities: ["CAPABILITY_NAMED_IAM"],
|
277
|
+
tags: []
|
278
|
+
}
|
279
|
+
|
280
|
+
if @config[:set_stack_as_name_tag]
|
281
|
+
update_hash[:tags] << { key: 'Name', value: @config[:stack_name]}
|
282
|
+
end
|
283
|
+
|
284
|
+
run_update update_hash
|
285
|
+
end
|
286
|
+
|
287
|
+
def run_update(update_hash)
|
288
|
+
cfn = Aws::CloudFormation::Client.new(region: @config['region'])
|
289
|
+
puts "debug update_hash"
|
290
|
+
puts update_hash
|
291
|
+
|
292
|
+
resp = cfn.update_stack(update_hash)
|
293
|
+
puts resp
|
294
|
+
|
295
|
+
puts 'wait until complete...'
|
296
|
+
stack_wait :stack_update_complete, {stack_name: @config[:stack_name] }
|
297
|
+
end
|
298
|
+
|
299
|
+
def template_url
|
300
|
+
"https://s3-#{@config['source_region']}.amazonaws.com/#{@config['source_bucket']}/cloudformation/#{@config['project']}/#{@config['application_name']}/#{@config['version']}/master.json"
|
301
|
+
# FIXME: make template url an actual template itself as per below
|
302
|
+
# @config = {:version=>"99", :cloudformation_bucket=>"my_cool_bucket", :project=>"the-project", :application=>"firefly"}
|
303
|
+
# url = "http://%{cloudformation_bucket}/cloudformation/%{project}/%{application}/%{version}/"
|
304
|
+
# url % @config
|
305
|
+
end
|
306
|
+
|
307
|
+
def verbose
|
308
|
+
STDERR
|
309
|
+
end
|
310
|
+
|
311
|
+
def show_events
|
312
|
+
cfn = Aws::CloudFormation::Client.new(region: @config['region'])
|
313
|
+
resp = cfn.describe_stack_events(stack_name: @config[:stack_name])
|
314
|
+
resp.stack_events.reverse_each do | e |
|
315
|
+
puts e.stack_id + ";;;" + e.event_id + ";;;" + e.stack_name + ";;;" + e.logical_resource_id #=> String
|
316
|
+
puts e.physical_resource_id #=> String
|
317
|
+
puts e.resource_type #=> String
|
318
|
+
puts e.timestamp #=> Time
|
319
|
+
puts e.resource_status #=> String, one of "CREATE_IN_PROGRESS", "CREATE_FAILED", "CREATE_COMPLETE", "DELETE_IN_PROGRESS", "DELETE_FAILED", "DELETE_COMPLETE", "DELETE_SKIPPED", "UPDATE_IN_PROGRESS", "UPDATE_FAILED", "UPDATE_COMPLETE"
|
320
|
+
puts e.resource_status_reason #=> String
|
321
|
+
puts e.resource_properties #=> String
|
322
|
+
end
|
323
|
+
end
|
324
|
+
|
325
|
+
def stack_wait(wait, name)
|
326
|
+
cfn = Aws::CloudFormation::Client.new(region: @config['region'])
|
327
|
+
begin
|
328
|
+
cfn.wait_until wait, name
|
329
|
+
rescue
|
330
|
+
raise "error doing #{wait} for #{name}"
|
331
|
+
end
|
332
|
+
end
|
333
|
+
end
|
334
|
+
end
|
metadata
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cfndslhelper
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Daragh Martin
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-03-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.13'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.13'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: aws-sdk
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: cfndsl
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: Write a longer description or delete this line.
|
84
|
+
email:
|
85
|
+
- daragh.martin@gmail.com
|
86
|
+
executables:
|
87
|
+
- cfndslhelper
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- ".gitignore"
|
92
|
+
- ".rspec"
|
93
|
+
- GEM-README.md
|
94
|
+
- Gemfile
|
95
|
+
- LICENSE.txt
|
96
|
+
- README.MD
|
97
|
+
- Rakefile
|
98
|
+
- bin/cfndslhelper
|
99
|
+
- bin/console
|
100
|
+
- bin/setup
|
101
|
+
- cfndslhelper.gemspec
|
102
|
+
- lib/cfndslhelper.rb
|
103
|
+
- lib/cfndslhelper/cli.rb
|
104
|
+
- lib/cfndslhelper/ext.rb
|
105
|
+
- lib/cfndslhelper/generate.rb
|
106
|
+
- lib/cfndslhelper/version.rb
|
107
|
+
homepage: https://github.com/daraghmartin/cfndslhelper
|
108
|
+
licenses:
|
109
|
+
- MIT
|
110
|
+
metadata: {}
|
111
|
+
post_install_message:
|
112
|
+
rdoc_options: []
|
113
|
+
require_paths:
|
114
|
+
- lib
|
115
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
requirements: []
|
126
|
+
rubyforge_project:
|
127
|
+
rubygems_version: 2.7.6
|
128
|
+
signing_key:
|
129
|
+
specification_version: 4
|
130
|
+
summary: Helper to provide functionality for developing with cfndsl
|
131
|
+
test_files: []
|