stackup 1.4.6 → 1.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e377001f70e0991601d52f67ddabf4ab13606eff27583f58433a9d4806a74191
4
- data.tar.gz: 7c6f3d425651c9ef3266bf32c815efd01a4c052eeb7cd46c9c6fcf3c4541da6b
3
+ metadata.gz: c15ca8477932ab203176cf7047ba309edae07fe35c36cdf797353d747bb74e5b
4
+ data.tar.gz: 195ebfa65f7fa5a3836abf59e855fe803f97e1dbc28965800f89c88f5b56a22d
5
5
  SHA512:
6
- metadata.gz: 3cb0be656aa5c84d209b6b840628d6dd0668c358147fb8cae30bd9e388b7df57161ed623d8c4158353fd791b4a669b20e60d49ab64f9a5582a6ad9ae29b1a78d
7
- data.tar.gz: f987a896bc1e2b58d802e6134f1e8808d22bf38daeda11c8f84926e2c2ea76bdb2a60ce68e212b13b178d494c3cc12dec79b2d644ec60940a88d15e30ff992e1
6
+ metadata.gz: 8439adf18ef0d019ea73e2205b9c0d33848f2151c48ef45e5b6f8552492d860bf0ad9477d625d62163537da997fc18c763310731a4f8735860e6edc4cf121b91
7
+ data.tar.gz: 8022894472208a085f0224c71e2e2bbfb9d896673c6fbd5a5af259c970383c8edec14cba14cc5cc576e8d203a15e1121bb682321ab5c79a224b3a6ac52ceb996
data/CHANGES.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # CHANGES
2
2
 
3
+ ## 1.5.0 (2020-04-21)
4
+
5
+ * Feature: --preserve-template-formatting
6
+
7
+ ## 1.4.6 (2019-12-09)
8
+
9
+ * Fix: Don't error out when receiving tags in AWS style (array of hashes) from YAML or JSON file
10
+
3
11
  ## 1.4.5 (2019-10-03)
4
12
 
5
13
  * Fix: Tags in RakeTasks
data/README.md CHANGED
@@ -155,7 +155,11 @@ This is to provide backwards compatibility with previously deployed stacks and m
155
155
 
156
156
  `stackup` supports input files (template, parameters, tags) in YAML format, as well as JSON.
157
157
 
158
- It also supports the [abbreviated YAML syntax for Cloudformation functions](https://aws.amazon.com/blogs/aws/aws-cloudformation-update-yaml-cross-stack-references-simplified-substitution/), though unlike the [AWS CLI](https://aws.amazon.com/cli/), Stackup normalises YAML input to JSON before invoking CloudFormation APIs.
158
+ It also supports the [abbreviated YAML syntax for Cloudformation functions](https://aws.amazon.com/blogs/aws/aws-cloudformation-update-yaml-cross-stack-references-simplified-substitution/), though unlike the [AWS CLI](https://aws.amazon.com/cli/), Stackup (by default) normalises YAML input to JSON before invoking CloudFormation APIs.
159
+
160
+ If you don't want normalisation of the YAML input to JSON, then use the `--preserve-template-formatting` flag to the `up` or `change-set create` commands.
161
+
162
+ Note: normalisation of S3 / HTTP URL stored templates is never done, as Cloudformation collects these directly.
159
163
 
160
164
  ### AWS credentials
161
165
 
@@ -181,6 +181,9 @@ Clamp do
181
181
  option ["-T", "--use-previous-template"], :flag,
182
182
  "reuse the existing template"
183
183
 
184
+ option ["-P", "--preserve-template-formatting"], :flag,
185
+ "do not normalise the template when calling the Cloudformation APIs; useful for preserving YAML and comments"
186
+
184
187
  include HasParameters
185
188
 
186
189
  option "--tags", "FILE", "stack tags file",
@@ -214,6 +217,7 @@ Clamp do
214
217
  options[:template_url] = template_source.location
215
218
  else
216
219
  options[:template] = template_source.data
220
+ options[:template_orig] = template_source.body
217
221
  end
218
222
  end
219
223
  options[:on_failure] = on_failure
@@ -229,6 +233,7 @@ Clamp do
229
233
  options[:role_arn] = service_role_arn if service_role_arn
230
234
  options[:use_previous_template] = use_previous_template?
231
235
  options[:capabilities] = capability_list
236
+ options[:preserve] = preserve_template_formatting?
232
237
  report_change do
233
238
  stack.create_or_update(options)
234
239
  end
@@ -274,6 +279,9 @@ Clamp do
274
279
  option ["-T", "--use-previous-template"], :flag,
275
280
  "reuse the existing template"
276
281
 
282
+ option ["-P", "--preserve-template-formatting"], :flag,
283
+ "do not normalise the template when calling the Cloudformation APIs; useful for preserving YAML and comments"
284
+
277
285
  option ["--force"], :flag,
278
286
  "replace existing change-set of the same name"
279
287
 
@@ -296,6 +304,7 @@ Clamp do
296
304
  options[:template_url] = template_source.location
297
305
  else
298
306
  options[:template] = template_source.data
307
+ options[:template_orig] = template_source.body
299
308
  end
300
309
  end
301
310
  options[:parameters] = parameters
@@ -304,6 +313,7 @@ Clamp do
304
313
  options[:use_previous_template] = use_previous_template?
305
314
  options[:force] = force?
306
315
  options[:capabilities] = capability_list
316
+ options[:preserve] = preserve_template_formatting?
307
317
  report_change do
308
318
  change_set.create(options)
309
319
  end
@@ -57,6 +57,9 @@ module Stackup
57
57
  options[:change_set_type] = stack.exists? ? "UPDATE" : "CREATE"
58
58
  force = options.delete(:force)
59
59
  options[:template_body] = MultiJson.dump(options.delete(:template)) if options[:template]
60
+ # optionally override template_body with the original template to preserve formatting (& comments in YAML)
61
+ template_orig = options.delete(:template_orig)
62
+ options[:template_body] = template_orig if options.delete(:preserve)
60
63
  options[:parameters] = Parameters.new(options[:parameters]).to_a if options[:parameters]
61
64
  options[:tags] = normalize_tags(options[:tags]) if options[:tags]
62
65
  options[:capabilities] ||= ["CAPABILITY_NAMED_IAM"]
@@ -119,6 +119,9 @@ module Stackup
119
119
  if (template_data = options.delete(:template))
120
120
  options[:template_body] = MultiJson.dump(template_data)
121
121
  end
122
+ # optionally override template_body with the original template to preserve formatting (& comments in YAML)
123
+ template_orig = options.delete(:template_orig)
124
+ options[:template_body] = template_orig if options.delete(:preserve)
122
125
  if (parameters = options[:parameters])
123
126
  options[:parameters] = Parameters.new(parameters).to_a
124
127
  end
@@ -1,5 +1,5 @@
1
1
  module Stackup
2
2
 
3
- VERSION = "1.4.6".freeze
3
+ VERSION = "1.5.0".freeze
4
4
 
5
5
  end
@@ -1,8 +1,8 @@
1
- require 'spec_helper'
2
- require 'stackup/rake_tasks'
1
+ require "spec_helper"
2
+ require "stackup/rake_tasks"
3
3
 
4
4
  RSpec.describe Stackup::RakeTasks do
5
- it 'can be required' do
5
+ it "can be required" do
6
6
  expect(described_class).to be_truthy
7
7
  end
8
8
  end
@@ -270,7 +270,7 @@ describe Stackup::Stack do
270
270
 
271
271
  it "converts them to an Array, that uses symbols as keys" do
272
272
  expected_tags = [
273
- { :key => "foo", :value => "bar" },
273
+ { :key => "foo", :value => "bar" }
274
274
  ]
275
275
  create_or_update
276
276
  expect(cf_client).to have_received(:create_stack) do |options|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stackup
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.6
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Williams
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-12-09 00:00:00.000000000 Z
12
+ date: 2020-04-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk-cloudformation