stackup 1.4.5 → 1.4.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d963de325ab9c50ad23fb0962aa34704dd002b48e9379d4437246d4298b763aa
4
- data.tar.gz: da6d00022a700f509867f655ef64c1787f84c2091159f8cf9dc552d2682698eb
3
+ metadata.gz: e377001f70e0991601d52f67ddabf4ab13606eff27583f58433a9d4806a74191
4
+ data.tar.gz: 7c6f3d425651c9ef3266bf32c815efd01a4c052eeb7cd46c9c6fcf3c4541da6b
5
5
  SHA512:
6
- metadata.gz: 619cfb540220d6b16477cb99ef8f04b71fd9470de38a6b55a2ed5d9ff25a0feaeb4f3a5491df3800bf32b8399aedb9a972576c995c2760cf22c1362358e1dfd0
7
- data.tar.gz: ad748effec9ed41253d99b1789ceddd6841c948d32658186c99fd6871e2814e320d493a465a2ba0122b012f013dec117019fb994a7c2c667f741b2e822f1075d
6
+ metadata.gz: 3cb0be656aa5c84d209b6b840628d6dd0668c358147fb8cae30bd9e388b7df57161ed623d8c4158353fd791b4a669b20e60d49ab64f9a5582a6ad9ae29b1a78d
7
+ data.tar.gz: f987a896bc1e2b58d802e6134f1e8808d22bf38daeda11c8f84926e2c2ea76bdb2a60ce68e212b13b178d494c3cc12dec79b2d644ec60940a88d15e30ff992e1
data/README.md CHANGED
@@ -78,10 +78,12 @@ For more details on usage, see
78
78
 
79
79
  ### Specifying parameters
80
80
 
81
- Stack parameters can be be read from a file, e.g.
81
+ Stack parameters can be read from a file, e.g.
82
82
 
83
83
  $ stackup myapp-test up -t template.json -p parameters.json
84
84
 
85
+ These files can be either JSON or YAML format, see [YAML support](#yaml-support) for more information.
86
+
85
87
  Parameters can be specified as simple key-value pairs:
86
88
 
87
89
  ```json
@@ -116,6 +118,22 @@ Or, you can specify one or more override parameters on the command-line, using `
116
118
  -o IndexDoc=index-override.html
117
119
  -o ContentDoc=content-override.html
118
120
 
121
+ ### Specifying tags
122
+
123
+ Stack tags can be read from a file, e.g.
124
+
125
+ $ stackup myapp-test up -t template.json --tags tags.json
126
+
127
+ These files can be either JSON or YAML format, see [YAML support](#yaml-support) for more information.
128
+
129
+ Tags are specified as simple key-value pairs:
130
+
131
+ ```json
132
+ {
133
+ "environment": "dev"
134
+ }
135
+ ```
136
+
119
137
  ### Acknowledging Capabilities
120
138
 
121
139
  CloudFormation requires that some stacks explicitly acknowledge certain capabilities before creation. This helps to prevent the creation of stacks with unintended privileges.
data/bin/stackup CHANGED
@@ -41,7 +41,7 @@ Clamp do
41
41
  option ["--[no-]wait"], :flag, "wait for stack updates to complete",
42
42
  :default => true
43
43
 
44
- option ["--wait-poll-interval"], "N", "polling interval while waiting for updates",
44
+ option ["--wait-poll-interval"], "N", "polling interval (in seconds) while waiting for updates",
45
45
  :default => 5, &method(:Integer)
46
46
 
47
47
  option "--debug", :flag, "enable debugging"
data/lib/stackup/stack.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "aws-sdk-cloudformation"
2
4
  require "logger"
3
5
  require "multi_json"
@@ -16,10 +18,10 @@ module Stackup
16
18
  DEFAULT_WAIT_POLL_INTERVAL = 5 # seconds
17
19
 
18
20
  def initialize(name, client = {}, options = {})
19
- client = Aws::CloudFormation::Client.new(client) if client.is_a?(Hash)
20
- @name = name
21
+ client = Aws::CloudFormation::Client.new(client) if client.is_a?(Hash)
22
+ @name = name
21
23
  @cf_client = client
22
- @wait = true
24
+ @wait = true
23
25
  options.each do |key, value|
24
26
  public_send("#{key}=", value)
25
27
  end
@@ -282,7 +284,7 @@ module Stackup
282
284
  end
283
285
 
284
286
  def create(options)
285
- options = options.dup
287
+ options = options.dup
286
288
  options[:stack_name] = name
287
289
  options.delete(:stack_policy_during_update_body)
288
290
  options.delete(:stack_policy_during_update_url)
@@ -312,7 +314,7 @@ module Stackup
312
314
  def event_handler
313
315
  @event_handler ||= lambda do |e|
314
316
  fields = [e.logical_resource_id, e.resource_status, e.resource_status_reason]
315
- time = e.timestamp.localtime.strftime("%H:%M:%S")
317
+ time = e.timestamp.localtime.strftime("%H:%M:%S")
316
318
  logger.info("[#{time}] #{fields.compact.join(' - ')}")
317
319
  end
318
320
  end
@@ -369,7 +371,13 @@ module Stackup
369
371
  { :key => key, :value => value.to_s }
370
372
  end
371
373
  else
372
- tags
374
+ tags.map do |tag|
375
+ if tag.key?("Key")
376
+ { :key => tag["Key"], :value => tag["Value"].to_s }
377
+ else
378
+ { :key => tag[:key], :value => tag[:value].to_s }
379
+ end
380
+ end
373
381
  end
374
382
  end
375
383
 
@@ -384,8 +392,8 @@ module Stackup
384
392
  handling_cf_errors do
385
393
  {}.tap do |result|
386
394
  cf_stack.public_send(collection_name).each do |item|
387
- key = item.public_send(key_name)
388
- value = item.public_send(value_name)
395
+ key = item.public_send(key_name)
396
+ value = item.public_send(value_name)
389
397
  result[key] = value
390
398
  end
391
399
  end
@@ -1,5 +1,5 @@
1
1
  module Stackup
2
2
 
3
- VERSION = "1.4.5".freeze
3
+ VERSION = "1.4.6".freeze
4
4
 
5
5
  end
@@ -260,6 +260,26 @@ describe Stackup::Stack do
260
260
 
261
261
  end
262
262
 
263
+ context "with :tags in SDK form as they arrive from file" do
264
+
265
+ before do
266
+ options[:tags] = [
267
+ { "Key" => "foo", "Value" => "bar" }
268
+ ]
269
+ end
270
+
271
+ it "converts them to an Array, that uses symbols as keys" do
272
+ expected_tags = [
273
+ { :key => "foo", :value => "bar" },
274
+ ]
275
+ create_or_update
276
+ expect(cf_client).to have_received(:create_stack) do |options|
277
+ expect(options[:tags]).to eq(expected_tags)
278
+ end
279
+ end
280
+
281
+ end
282
+
263
283
  context "with :tags in SDK form" do
264
284
 
265
285
  before do
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.5
4
+ version: 1.4.6
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-10-03 00:00:00.000000000 Z
12
+ date: 2019-12-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk-cloudformation