cloudformation-tool 1.2.2 → 1.4.0
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/README.md +219 -18
- data/lib/cloud_formation_tool/cli/main.rb +1 -1
- data/lib/cloud_formation_tool/cloud_formation.rb +8 -2
- data/lib/cloud_formation_tool/cloud_formation/nested_stack.rb +25 -0
- data/lib/cloud_formation_tool/cloud_formation/stack.rb +58 -6
- data/lib/cloud_formation_tool/cloud_init.rb +1 -1
- data/lib/cloud_formation_tool/version.rb +1 -1
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 818f632bb0756f9be2ba922936b2a68e93a12d3af1a10b069e48941dd0615cfd
|
4
|
+
data.tar.gz: 612c5e90b2a95f54435e1ddcbd65a4f833863097c61709a7d9d6895dd041c91e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed6cb8daf2f5990b0a0df87149f9537e29153aacaa65c81a73fee2f2dc05e7d882a99463c22e1fafb00f46757961418df392e730cca805783922ad62db6114ba
|
7
|
+
data.tar.gz: 9d584621509bf30401687ca5c946d9dd45d38a9ad6454b929283099db0ed2ae2aa4ddf93eecf2e123936c4c0a98c605bbe9bfb38c44609c94d4b06e09f626cb1
|
data/README.md
CHANGED
@@ -103,27 +103,30 @@ multiple sub-templates, this is an error that would cause the tool to abort.
|
|
103
103
|
|
104
104
|
### Loading user data files
|
105
105
|
|
106
|
-
When specifying a user-data block for a `LaunchConfiguration` resource
|
107
|
-
resource, the user-data can be loaded from an external
|
108
|
-
is currently supported, sorry) by specifying the
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
106
|
+
When specifying a user-data block for a `LaunchConfiguration` resource, `Instance`
|
107
|
+
resource, or a `LaunchTemplate` resource, the user-data can be loaded from an external
|
108
|
+
YAML file (only YAML formatted user-data is currently supported, sorry) by specifying the
|
109
|
+
`UserData` element as a map with the single field `File` that is set with the relative
|
110
|
+
path to the user-data file. The user-data file is expected to be a cloud-init configuration
|
111
|
+
file with the default extension `.init` (but there really aren't any filename requirements).
|
112
|
+
|
113
|
+
Alternatively, the field `FileTemplate` can be used under `UserData` to load an external
|
114
|
+
cloud-init configuration file that includes variable place holders for the
|
115
|
+
(CloudFormation intrinsic function Sub)[http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-sub.html].
|
116
|
+
The `FileTemplate` mode supports all the features described above as well as it performs
|
117
|
+
the parsing detailed below, except compression and S3 offloading - as doing so prevents
|
118
|
+
CloudFormation from performing the substitution operation. As a result, if the resulting
|
119
|
+
cloud-init file is larger than 16KB you should expect that the template will fail to create
|
120
|
+
the stack.
|
118
121
|
|
119
122
|
#### User data file parsing
|
120
123
|
|
121
124
|
The reference file will be loaded and parsed as a ("Cloud Config data" file)[http://cloudinit.readthedocs.io/en/latest/topics/format.html#cloud-config-data]
|
122
|
-
with the special `write_files` and `write_directories` enhancement (see below).
|
123
|
-
does not exceed the user-data size limitation.
|
124
|
-
|
125
|
-
|
126
|
-
the S3 object.
|
125
|
+
with the special `write_files` and `write_directories` enhancement (see below).
|
126
|
+
The result is then checked that it does not exceed the user-data size limitation.
|
127
|
+
If the file is bigger than can fit in the AWS user-data block, it will first be compressed
|
128
|
+
using gzip and if it is still too large, it will be uploaded to S3 and the user-data block
|
129
|
+
will be set with a cloud-init download reference to the S3 object.
|
127
130
|
|
128
131
|
##### Enhanced `write_files`
|
129
132
|
|
@@ -216,6 +219,102 @@ specifying the S3 bucket and object key, either of the following fields may be u
|
|
216
219
|
Role: !GetAtt [ LambdaExecutionRole, Arn ]
|
217
220
|
```
|
218
221
|
|
222
|
+
### Nested Stacks Modules
|
223
|
+
|
224
|
+
The CloudFormation pre-compiler supports loading local templates as "nested stacks" using the
|
225
|
+
CloudFormation `AWS::CloudFormation::Stack` resource type.
|
226
|
+
|
227
|
+
Instead of first pre-deploying a template to S3 to be used for a nested stack, use the
|
228
|
+
`Template` property (instead of the `TemplateURL` property) to point to a local
|
229
|
+
sub-template. The sub-template will be compiled separately and deployed automatically to
|
230
|
+
an S3 bucket before deploying the compiled template to CloudFormation.
|
231
|
+
|
232
|
+
The `monitor` tool (also used during `create` operation) supports nested stacks by
|
233
|
+
automatically detecting nested stack updates in the main stack's event stream and will
|
234
|
+
start streaming the nested stack events - this allows the user to more easily locate problems
|
235
|
+
with nested stacks.
|
236
|
+
|
237
|
+
Currently there's no automatic resolution of references between nested and parent stacks, so
|
238
|
+
make sure to set up nested stack parameters for all resources that should be referenced from
|
239
|
+
the parent stack.
|
240
|
+
|
241
|
+
#### Example
|
242
|
+
|
243
|
+
`cloud-formation.yaml`:
|
244
|
+
|
245
|
+
```
|
246
|
+
AWSTemplateFormatVersion: "2010-09-09"
|
247
|
+
Description: "CloudFormation template with nested stacks"
|
248
|
+
Parameters:
|
249
|
+
DomainName:
|
250
|
+
Description: "The DNS domain name for the system"
|
251
|
+
Type: String
|
252
|
+
Default: example.com
|
253
|
+
AMI:
|
254
|
+
Description: "The AMI ID for the image to deploy"
|
255
|
+
Type: String
|
256
|
+
Default: ami-af4333cf
|
257
|
+
|
258
|
+
Resources:
|
259
|
+
VPC:
|
260
|
+
Type: AWS::EC2::VPC
|
261
|
+
Properties:
|
262
|
+
CidrBlock: 172.20.0.0/16
|
263
|
+
EnableDnsSupport: true
|
264
|
+
EnableDnsHostnames: true
|
265
|
+
SecurityGroupExample:
|
266
|
+
Type: AWS::EC2::SecurityGroup
|
267
|
+
Properties:
|
268
|
+
VpcId: !Ref VPC
|
269
|
+
GroupDescription: example security group
|
270
|
+
SecurityGroupIngress:
|
271
|
+
- { IpProtocol: icmp, CidrIp: 0.0.0.0/0, FromPort: -1, ToPort: -1 }
|
272
|
+
- { IpProtocol: tcp, CidrIp: 0.0.0.0/0, FromPort: 22, ToPort: 22 }
|
273
|
+
ServiceStack:
|
274
|
+
Type: AWS::CloudFormation::Stack
|
275
|
+
Properties:
|
276
|
+
Template: service.yaml
|
277
|
+
Parameters:
|
278
|
+
DomainName: !Ref DomainName
|
279
|
+
AMI: !Ref AMI
|
280
|
+
VPC: !Ref VPC
|
281
|
+
```
|
282
|
+
|
283
|
+
`service.yaml`:
|
284
|
+
|
285
|
+
```
|
286
|
+
AWSTemplateFormatVersion: "2010-09-09"
|
287
|
+
Description: "Service nested stack"
|
288
|
+
Parameters:
|
289
|
+
DomainName:
|
290
|
+
Description: "The DNS domain name for the system"
|
291
|
+
Type: String
|
292
|
+
AMI:
|
293
|
+
Description: "The AMI ID for the image to deploy"
|
294
|
+
Type: String
|
295
|
+
VPC:
|
296
|
+
Description: "The VPC into which to deploy the service"
|
297
|
+
Type: String
|
298
|
+
|
299
|
+
Resources:
|
300
|
+
Subnet:
|
301
|
+
Type: AWS::EC2::Subnet
|
302
|
+
Properties:
|
303
|
+
AvailabilityZone: !Select [ 0, !GetAZs { Ref: "AWS::Region" } ]
|
304
|
+
CidrBlock: 172.20.0.0/24
|
305
|
+
MapPublicIpOnLaunch: true
|
306
|
+
VpcId: !Ref VPC
|
307
|
+
Ec2Instance:
|
308
|
+
Type: AWS::EC2::Instance
|
309
|
+
Properties:
|
310
|
+
ImageId: !Ref AMI
|
311
|
+
KeyName: "secret"
|
312
|
+
NetworkInterfaces:
|
313
|
+
- AssociatePublicIpAddress: "true"
|
314
|
+
DeviceIndex: "0"
|
315
|
+
SubnetId: !Ref Subnet
|
316
|
+
```
|
317
|
+
|
219
318
|
## Caching
|
220
319
|
|
221
320
|
Some resource compilation may require uploading to S3, such as Lambda code or cloud-init setup
|
@@ -248,7 +347,12 @@ The following commands are supported:
|
|
248
347
|
- `status` - Check if the names stack exists or not
|
249
348
|
- `delete` - Delete the specified stack. After issuing the delete command, the tool will
|
250
349
|
immediately start `monitor` mode until the operation has completed.
|
251
|
-
- `servers` - List EC2 instances created and managed by this stack.
|
350
|
+
- `servers` - List EC2 instances created and managed by this stack, per autoscaling group, including servers in nested stacks.
|
351
|
+
- `groups` - list autoscaling groups managed by the stack, including groups in nested stacks.
|
352
|
+
- `recycle` - recycle servers in an autoscaling group in a stack by scaling the group up and down.
|
353
|
+
- `scale` - set the scale of an autoscaling group managed by a stack to a specific desired value.
|
354
|
+
- `invalidate` - send an invalidation request to a CloudFront distribution managed by a stack.
|
355
|
+
- `output` - retrieve output values from a stack.
|
252
356
|
|
253
357
|
Please see the specific help for each command by running `cftool <command> --help` for
|
254
358
|
more details and specific options.
|
@@ -260,3 +364,100 @@ The AWS region to be used can be select by specifying top level option (i.e. bef
|
|
260
364
|
### Credentials Selection
|
261
365
|
|
262
366
|
The tool will use the standard AWS credentials selection process, except when you want to use AWS CLI configured credential profiles, you may select to use a profile other than "default" by specifying the top level option (i.e. before the command name) `-p <profile>`, by providing the standard environment variable `AWS_DEFAULT_PROFILE` or by having a file called `.awsprofile` - whose content is the name of a valid AWS REGION - in a parent directory (at any level up to the root directory).
|
367
|
+
|
368
|
+
## Library API
|
369
|
+
|
370
|
+
The cloudformatin tool can also be consumed as a library by other applications - for example an application that needs to perform high-level business-logic oriented
|
371
|
+
operations for a specific application deployed in a stack, using the cloudformation tool abstraction of CloudFormation templates and stacks.
|
372
|
+
|
373
|
+
### Usage as a library
|
374
|
+
|
375
|
+
To use the cloudformatin tool as a library, require `cloud_formation_tool`.
|
376
|
+
|
377
|
+
### CloudFormation templates
|
378
|
+
|
379
|
+
The cloudformation pre-compiler can be used to manipulate pre-compiled templates.
|
380
|
+
|
381
|
+
To access the pre-compiler, initialize a `CloudFormationTool::CloudFormation` with the path to the local template resource (either a file or a directory that can be
|
382
|
+
parsed by the pre-compiler).
|
383
|
+
|
384
|
+
The initial template resource will be loaded but will not be fully parsed - and included elements will not be read - until the `compile` method is called.
|
385
|
+
|
386
|
+
The following method calls are available on the `CloudFormation` instance:
|
387
|
+
|
388
|
+
#### `compile(parameters = nil)`
|
389
|
+
|
390
|
+
Pre-compiles the template, with the provided parameter `Hash`, if provided. Returns a `Hash` repsenting the compiled template.
|
391
|
+
|
392
|
+
#### `to_yaml`
|
393
|
+
|
394
|
+
Pre-compiles the template and returns a YAML rendering of the CloudFormation template, suitable for deploying to AWS CloudFormation.
|
395
|
+
|
396
|
+
#### `each`
|
397
|
+
|
398
|
+
Yields a tuple for each defined template parameter, that includes the parameter's name and its default value (if set, `nil` otherwise).
|
399
|
+
|
400
|
+
### CloudFormation stacks
|
401
|
+
|
402
|
+
The cloudformation tool's abstraction of a CloudFormation stack can be used to manipulate stack resouces, such as autoscaling groups or instances in a stack context.
|
403
|
+
|
404
|
+
To access the stack API, initialize a `CloudFormationTool::CloudFormation::Stack` with the name of the stack. You can then access the following methods:
|
405
|
+
|
406
|
+
#### `exist?`
|
407
|
+
|
408
|
+
Check if a stack exists.
|
409
|
+
|
410
|
+
#### `create(template, params = {})`
|
411
|
+
|
412
|
+
Create or update a stack by deploying the specified template. The template can be any local file or directory resource that can be parsed by the cloudformation pre-compiler.
|
413
|
+
|
414
|
+
#### `delete`
|
415
|
+
|
416
|
+
Deletes the stack
|
417
|
+
|
418
|
+
#### `stack_id`
|
419
|
+
|
420
|
+
Return the AWS CloudFormation stack identifier for the stack, which is the ARN of the stack.
|
421
|
+
|
422
|
+
#### `output`
|
423
|
+
|
424
|
+
Returns the output values of the stack
|
425
|
+
|
426
|
+
#### `resources`
|
427
|
+
|
428
|
+
Return a list of resources in the stack and all of its nested stacks
|
429
|
+
|
430
|
+
#### `asgroups`
|
431
|
+
|
432
|
+
Return a list of autoscaling groups in the stack and all of its nested stacks. The returned values are AWS SDK CloudFormation resources, extended with a set of methods
|
433
|
+
to help manage autoscaling groups:
|
434
|
+
|
435
|
+
##### `group`
|
436
|
+
|
437
|
+
Returns the AWS SDK `Aws::AutoScaling::AutoScalingGroup` object for the autoscaling group.
|
438
|
+
|
439
|
+
#### `cdns`
|
440
|
+
|
441
|
+
Return a list of CloudFront CDN distributions in the stack and all of its nested stacks. The returnd values are AWS SDK CloudFormation resources, extended with a set of
|
442
|
+
methods to help manage CloudFront distributions:
|
443
|
+
|
444
|
+
##### `distribution`
|
445
|
+
|
446
|
+
Returns the AWS SDK `Aws::CloudFront::Types::Distribution` object for the CloudFront distribution.
|
447
|
+
|
448
|
+
##### `domain_names`
|
449
|
+
|
450
|
+
Returns the comma delimited list of the distribution aliases domain names
|
451
|
+
|
452
|
+
##### `invalidate(path)`
|
453
|
+
|
454
|
+
Creates a new invalidation in the CloudFront distribution with the specified path expression
|
455
|
+
|
456
|
+
#### `each`
|
457
|
+
|
458
|
+
Yields CloudFormation stack events, in the order they were created. Subsequent calls to `each` will not repeat events previously yielded and will only yield additional
|
459
|
+
events created since the last call to `each`.
|
460
|
+
|
461
|
+
#### `see_event`
|
462
|
+
|
463
|
+
Mark all events since the last call to `each` (or from stack creation, if `each` was not previously called) as "seen" so they will not be yielded in future calls to `each`.
|
@@ -31,7 +31,7 @@ module CloudFormationTool
|
|
31
31
|
|
32
32
|
option [ "-d", "--debug" ], :flag, "Enable debug logging" do
|
33
33
|
logger.level = Logger::Severity::DEBUG
|
34
|
-
logger.formatter =
|
34
|
+
logger.formatter = nil
|
35
35
|
end
|
36
36
|
|
37
37
|
option [ "-q", "--quiet" ], :flag, "Enable debug logging" do
|
@@ -23,7 +23,7 @@ module CloudFormationTool
|
|
23
23
|
begin
|
24
24
|
text = File.read(@path)
|
25
25
|
# remove comments because white space seen between comments can seriously psych Psych
|
26
|
-
text.gsub!(/^#.*\n
|
26
|
+
text.gsub!(/^#.*\n/,'')
|
27
27
|
text = fixShorthand(text)
|
28
28
|
@data = YAML.load(text).to_h
|
29
29
|
rescue Psych::SyntaxError => e
|
@@ -167,7 +167,7 @@ module CloudFormationTool
|
|
167
167
|
restype = data['Type'] if restype.nil? and data.key?('Type')
|
168
168
|
data.inject({}) do |dict, (key, val)|
|
169
169
|
dict[key] = case restype
|
170
|
-
when 'AWS::AutoScaling::LaunchConfiguration'
|
170
|
+
when 'AWS::AutoScaling::LaunchConfiguration', 'AWS::EC2::LaunchTemplate'
|
171
171
|
if (key == "UserData") and (val["File"])
|
172
172
|
# Support LaunchConfiguration UserData from file
|
173
173
|
CloudInit.new("#{@basedir}/#{val["File"]}").to_base64
|
@@ -183,6 +183,12 @@ module CloudFormationTool
|
|
183
183
|
else
|
184
184
|
load_files(val, restype)
|
185
185
|
end
|
186
|
+
when 'AWS::CloudFormation::Stack'
|
187
|
+
if key == 'Properties' and val.key?('Template')
|
188
|
+
NestedStack.new(val, self).to_cloudformation
|
189
|
+
else
|
190
|
+
load_files(val, restype)
|
191
|
+
end
|
186
192
|
else
|
187
193
|
load_files(val, restype)
|
188
194
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module CloudFormationTool
|
2
|
+
class CloudFormation
|
3
|
+
|
4
|
+
class NestedStack
|
5
|
+
include Storable
|
6
|
+
|
7
|
+
def initialize(props, tpl)
|
8
|
+
@tpl = tpl
|
9
|
+
@data = props
|
10
|
+
if props.key?('Template')
|
11
|
+
path = props['Template']
|
12
|
+
path = if path.start_with? "/" then path else "#{@tpl.basedir}/#{path}" end
|
13
|
+
@content = CloudFormation.new(path).to_yaml
|
14
|
+
@data['TemplateURL'] = upload(make_filename('yaml'), @content, mime_type: 'text/yaml', gzip: false)
|
15
|
+
@data.delete('Template')
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def to_cloudformation
|
20
|
+
@data
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -15,6 +15,7 @@ module CloudFormationTool
|
|
15
15
|
@name = name
|
16
16
|
@seenev = Set.new
|
17
17
|
@watch_timeouts = 0
|
18
|
+
@nested_stacks = Hash[]
|
18
19
|
end
|
19
20
|
|
20
21
|
def delete
|
@@ -95,7 +96,14 @@ module CloudFormationTool
|
|
95
96
|
def resources
|
96
97
|
begin
|
97
98
|
awscf.list_stack_resources(stack_name: @name).each do |resp|
|
98
|
-
resp.stack_resource_summaries.each
|
99
|
+
resp.stack_resource_summaries.each do |res|
|
100
|
+
yield res
|
101
|
+
if res.resource_type == 'AWS::CloudFormation::Stack'
|
102
|
+
Stack.new(res.physical_resource_id).resources do |nested_res|
|
103
|
+
yield nested_res
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
99
107
|
end
|
100
108
|
rescue Aws::CloudFormation::Errors::ValidationError => e
|
101
109
|
raise CloudFormationTool::Errors::AppError, "Failed to get resources: #{e.message}"
|
@@ -133,6 +141,7 @@ module CloudFormationTool
|
|
133
141
|
end
|
134
142
|
|
135
143
|
def monitor(start_time = nil)
|
144
|
+
@nested_stacks = Hash[]
|
136
145
|
done = false
|
137
146
|
begin
|
138
147
|
until done
|
@@ -140,26 +149,65 @@ module CloudFormationTool
|
|
140
149
|
next if @seenev.add?(ev.event_id).nil?
|
141
150
|
text = "#{ev.timestamp.strftime "%Y-%m-%d %H:%M:%S"}| " + %w(
|
142
151
|
resource_type:40
|
143
|
-
logical_resource_id:
|
152
|
+
logical_resource_id:42
|
144
153
|
resource_status
|
145
154
|
).collect { |field|
|
146
155
|
(name,size) = field.split(":")
|
147
156
|
size ||= 1
|
148
|
-
|
157
|
+
(if name == 'logical_resource_id' and ev.stack_name != self.name
|
158
|
+
logical_nested_stack_name(ev.stack_name) + "|"
|
159
|
+
else
|
160
|
+
''
|
161
|
+
end + ev.send(name.to_sym)).ljust(size.to_i, ' ')
|
149
162
|
}.join(" ")
|
150
163
|
text += " " + ev.resource_status_reason if ev.resource_status =~ /_FAILED/
|
151
164
|
if start_time.nil? or start_time < ev.timestamp
|
152
165
|
puts text
|
153
166
|
end
|
154
|
-
|
167
|
+
check_nested_stack(ev)
|
168
|
+
done = is_final_event(ev)
|
155
169
|
end
|
170
|
+
sleep 1
|
156
171
|
end
|
157
172
|
rescue CloudFormationTool::Errors::StackDoesNotExistError => e
|
158
173
|
puts "Stack #{name} does not exist"
|
159
174
|
end
|
160
175
|
end
|
161
176
|
|
177
|
+
def logical_nested_stack_name(phys_name)
|
178
|
+
@nested_stacks[phys_name] || 'unknown'
|
179
|
+
end
|
180
|
+
|
181
|
+
def nested_stack_name(ev)
|
182
|
+
ev.physical_resource_id.split('/')[1]
|
183
|
+
end
|
184
|
+
|
185
|
+
def check_nested_stack(ev)
|
186
|
+
return unless ev.resource_type == "AWS::CloudFormation::Stack" and
|
187
|
+
ev.logical_resource_id != self.name # not nested stack
|
188
|
+
return if @nested_stacks.has_key? ev.logical_resource_id # seeing the first or last nested stack event - ignoring
|
189
|
+
@nested_stacks[nested_stack_name(ev)] = ev.logical_resource_id
|
190
|
+
end
|
191
|
+
|
192
|
+
def is_final_event(ev)
|
193
|
+
ev.resource_type == "AWS::CloudFormation::Stack" and
|
194
|
+
ev.resource_status =~ /(_COMPLETE|_FAILED)$/ and
|
195
|
+
ev.logical_resource_id == self.name
|
196
|
+
end
|
197
|
+
|
198
|
+
def tracked_stacks
|
199
|
+
[ self.name ] + @nested_stacks.keys.compact
|
200
|
+
end
|
201
|
+
|
162
202
|
def each
|
203
|
+
tracked_stacks.each do |name|
|
204
|
+
events_for(name) do |ev|
|
205
|
+
yield ev
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
def events_for(stack_name)
|
163
211
|
token = nil
|
164
212
|
sleep(if @_last_poll_time.nil?
|
165
213
|
0
|
@@ -172,7 +220,7 @@ module CloudFormationTool
|
|
172
220
|
end
|
173
221
|
end)
|
174
222
|
begin
|
175
|
-
resp = awscf.describe_stack_events stack_name:
|
223
|
+
resp = awscf.describe_stack_events stack_name: stack_name, next_token: token
|
176
224
|
@watch_timeouts = 0
|
177
225
|
resp.stack_events.each do |ev|
|
178
226
|
yield ev
|
@@ -188,7 +236,11 @@ module CloudFormationTool
|
|
188
236
|
end
|
189
237
|
rescue Aws::CloudFormation::Errors::ValidationError => e
|
190
238
|
if e.message =~ /does not exist/
|
191
|
-
|
239
|
+
if stack_name == self.name
|
240
|
+
raise CloudFormationTool::Errors::StackDoesNotExistError, "Stack does not exist"
|
241
|
+
end
|
242
|
+
# ignore "does not exist" errors on nested stacks - we may try to poll them before
|
243
|
+
# they actually exist. We'll just try later
|
192
244
|
else
|
193
245
|
raise e
|
194
246
|
end
|
@@ -45,7 +45,7 @@ module CloudFormationTool
|
|
45
45
|
def encode(allow_gzip = true)
|
46
46
|
yamlout = compile
|
47
47
|
usegzip = false
|
48
|
-
if allow_gzip and yamlout.size >
|
48
|
+
if allow_gzip and yamlout.size > 16000 # max AWS EC2 user data size - try compressing it
|
49
49
|
yamlout = Zlib::Deflate.new(nil, 31).deflate(yamlout, Zlib::FINISH) # 31 is the magic word to have deflate create a gzip compatible header
|
50
50
|
usegzip = true
|
51
51
|
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudformation-tool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oded Arbel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 12.3.3
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 12.3.3
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: clamp
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -168,6 +168,7 @@ files:
|
|
168
168
|
- lib/cloud_formation_tool/cloud_formation.rb
|
169
169
|
- lib/cloud_formation_tool/cloud_formation/cloud_front_distribution.rb
|
170
170
|
- lib/cloud_formation_tool/cloud_formation/lambda_code.rb
|
171
|
+
- lib/cloud_formation_tool/cloud_formation/nested_stack.rb
|
171
172
|
- lib/cloud_formation_tool/cloud_formation/stack.rb
|
172
173
|
- lib/cloud_formation_tool/cloud_init.rb
|
173
174
|
- lib/cloud_formation_tool/errors.rb
|
@@ -192,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
192
193
|
- !ruby/object:Gem::Version
|
193
194
|
version: '0'
|
194
195
|
requirements: []
|
195
|
-
rubygems_version: 3.
|
196
|
+
rubygems_version: 3.1.2
|
196
197
|
signing_key:
|
197
198
|
specification_version: 4
|
198
199
|
summary: A pre-compiler tool for CloudFormation YAML templates
|