knife-cloudformation 0.2.16 → 0.2.18

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
  SHA1:
3
- metadata.gz: 8f6138fcf5ddcc304b7478dd147ef1e695604947
4
- data.tar.gz: fb547147dced569d4069d8a9cfca9a356c52ce09
3
+ metadata.gz: 677c87eed9a6f47f2a1d64292f4a8950afa75cf9
4
+ data.tar.gz: 381c7d8d90d90be1972a9bfa3dc1571fd82fef81
5
5
  SHA512:
6
- metadata.gz: 68cb17f7dc76e7787264d7c78ef09d1c463539604ffc7c44491df1307f369caea038c939f899dfb6663a8a72a7ecd13b3ab3d45dcb3536991bc570777ec09eb9
7
- data.tar.gz: 310afcce101083ac2c494eb4c2539404513f1eeb688abd6b0b0b68af19f4d3435956fa779f086badccc07f924f2de30ad879babf2cd40808e5a6d417770b2d18
6
+ metadata.gz: 8377709a7c24992e5aad34313ae2735501f24e2c1cfadfff8e31b410aa6efbf48c8cecace55ee30a7718043dac369bb2ac9e42e7077bffa8dfbde2e3028ad902
7
+ data.tar.gz: a71a840ba3c95ace1b1a0a6887a20bb067d94f0d7c48c61b2a94f25f3a8eb0b4f150f1094932b836b1e71456de37c73c349846285e718405c78fd76f2d9dd126
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## v0.2.18
2
+ * Fix nested stack URL generation
3
+
1
4
  ## v0.2.16
2
5
  * Fix broken validation command (#12 thanks @JonathanSerafini)
3
6
  * Pad stack name indexes when unpacked
data/README.md CHANGED
@@ -1,51 +1,55 @@
1
1
  # Knife CloudFormation
2
2
 
3
- A plugin for the knife command provided by Chef to
4
- interact with AWS CloudFormation.
3
+ This is a plugin for the `knife` command provided by
4
+ Chef to interact with AWS (and other) orchestration
5
+ APIs.
5
6
 
6
- ## Compatibility
7
+ ## API Compatibility
7
8
 
8
- This plugin now provides support for other cloud
9
- orchestration APIs as well:
10
-
11
- * OpenStack
9
+ * AWS
12
10
  * Rackspace
11
+ * OpenStack
13
12
 
14
13
  ## Configuration
15
14
 
16
15
  The easiest way to configure the plugin is via the
17
16
  `knife.rb` file. Credentials are the only configuration
18
17
  requirement, and the `Hash` provided is proxied to
19
- Miasma:
18
+ [Miasma][miasma]:
19
+
20
+ ### AWS
20
21
 
21
22
  ```ruby
22
23
  # .chef/knife.rb
23
24
 
24
25
  knife[:cloudformation][:credentials] = {
26
+ :provider => :aws,
25
27
  :aws_access_key_id => ENV['AWS_ACCESS_KEY_ID'],
26
28
  :aws_secret_access_key => ENV['AWS_SECRET_ACCESS_KEY'],
27
29
  :aws_region => ENV['AWS_REGION']
28
30
  }
29
31
  ```
30
32
 
31
- If are using Rackspace:
33
+ ### Rackspace
32
34
 
33
35
  ```ruby
34
36
  # .chef/knife.rb
35
37
 
36
38
  knife[:cloudformation][:credentials] = {
39
+ :provider => :rackspace,
37
40
  :rackspace_username => ENV['RACKSPACE_USERNAME'],
38
41
  :rackspace_api_key => ENV['RACKSPACE_API_KEY'],
39
42
  :rackspace_region => ENV['RACKSPACE_REGION']
40
43
  }
41
44
  ```
42
45
 
43
- If are using OpenStack:
46
+ ### OpenStack
44
47
 
45
48
  ```ruby
46
49
  # .chef/knife.rb
47
50
 
48
51
  knife[:cloudformation][:credentials] = {
52
+ :provider => :open_stack,
49
53
  :open_stack_username => ENV['OPENSTACK_USERNAME'],
50
54
  :open_stack_password => ENV['OPENSTACK_PASSWORD'],
51
55
  :open_stack_identity_url => ENV['OPENSTACK_IDENTITY_URL'],
@@ -64,7 +68,253 @@ knife[:cloudformation][:credentials] = {
64
68
  * `knife cloudformation inspect`
65
69
  * `knife cloudformation validate`
66
70
 
71
+ ### `knife cloudformation list`
72
+
73
+ Provides listing of current stacks and state of each stack.
74
+
75
+ #### Supported options
76
+
77
+ * `--attribute ATTR` stack attribute to display
78
+ * `--status STATUS` match stacks with given status
79
+
80
+ ### `knife cloudformation validate`
81
+
82
+ Validates template with API
83
+
84
+ #### Supported options
85
+
86
+ * `--[no-]processing` enable template processing
87
+ * `--file PATH` path to stack template file
88
+ * `--translate PROVIDER` translate template to provider
89
+ * `--[no-]apply-nesting` apply template nesting logic
90
+ * `--nesting-bucket BUCKET` asset store bucket to place nested stack templates
91
+
92
+ ### `knife cloudformation create NAME`
93
+
94
+ Creates a new stack with the provided name (`NAME`).
95
+
96
+ #### Supported options
97
+
98
+ * `--timeout MINUTES` stack creation timeout limit
99
+ * `--[no-]rollback` disable rollback on failure
100
+ * `--capability CAPABILITY` enable capability within API
101
+ * `--notifications ARN` add notification ARN
102
+ * `--print-only` print stack template JSON and exit
103
+ * `--apply-stack NAME` apply existing stack outputs
104
+ * `--[no-]processing` enable template processing
105
+ * `--file PATH` path to stack template file
106
+ * `--translate PROVIDER` translate template to provider
107
+ * `--[no-]apply-nesting` apply template nesting logic
108
+ * `--nesting-bucket BUCKET` asset store bucket to place nested stack templates
109
+
110
+ #### Apply Stacks
111
+
112
+ The `--apply-stack` option allows providing the name of an existing
113
+ stack when creating or updating. Applying stacks is simply fetching
114
+ the outputs from the applied stacks and automatically defaulting the
115
+ set parameter of the new or updated stack. Outputs are matched
116
+ by name to the parameters of the target stack. This allows an easy
117
+ way to use values from existing stacks when building new stacks.
118
+
119
+ Example:
120
+
121
+ StackA:
122
+
123
+ ```json
124
+ ...
125
+ "Outputs": {
126
+ "LoadBalancerAddress": {
127
+ "Description": "Address of Load Balancer",
128
+ "Value": {
129
+ "Fn::GetAtt": [
130
+ "LoadBalancerResource",
131
+ "DNSName"
132
+ ]
133
+ }
134
+ }
135
+ }
136
+ ...
137
+ ```
138
+
139
+ StackB:
140
+
141
+ ```json
142
+ ...
143
+ "Parameters": {
144
+ "LoadBalancerAddress": {
145
+ "Type": "String",
146
+ "Default": "unset"
147
+ }
148
+ }
149
+ ...
150
+ ```
151
+
152
+ When creating StackB, if we use the `--apply-stack` option:
153
+
154
+ ```
155
+ $ knife cloudformation create StackB --apply-stack StackA
156
+ ```
157
+
158
+ when prompted for the stack parameters, we will find the parameter
159
+ value for `LoadBalancerAddress` to be filled in with the output
160
+ provided from StackA.
161
+
162
+ #### Processing
163
+
164
+ The default behavior of this plugin assumes templates will be
165
+ in JSON format. The `--processing` flag will allow providing Ruby
166
+ files to dynamically generate templates using the SparkleFormation
167
+ library.
168
+
169
+ _NOTE: (SparkleFormation Usage Documentation)[]._
170
+
171
+ This plugin supports the advanced stack nesting feature provided by
172
+ the SparkleFormation library.
173
+
174
+
175
+ #### Translations
176
+
177
+ Translations are currently an `alpha` feature and only a subset of
178
+ resources are supported.
179
+
180
+ ### `knife cloudformation update STACK`
181
+
182
+ Update an existing stack.
183
+
184
+ #### Supported options
185
+
186
+ * `--print-only` print stack template JSON and exit
187
+ * `--apply-stack NAME` apply existing stack outputs
188
+ * `--[no-]processing` enable template processing
189
+ * `--file PATH` path to stack template file
190
+ * `--translate PROVIDER` translate template to provider
191
+ * `--[no-]apply-nesting` apply template nesting logic
192
+ * `--nesting-bucket BUCKET` asset store bucket to place nested stack templates
193
+
194
+ ### `knife cloudformation destroy STACK`
195
+
196
+ Destroy an existing stack.
197
+
198
+ #### Name globs
199
+
200
+ The destroy command supports globbing for performing multiple
201
+ destructions based on glob match. For example, given existing
202
+ stacks:
203
+
204
+ * TestStack1
205
+ * TestStack2
206
+ * Production
207
+
208
+ running the following command:
209
+
210
+ ```
211
+ $ knife cloudformation destroy Test*
212
+ ```
213
+
214
+ will destroy the `TestStack1` and `TestStack2`
215
+
216
+ ### `knife cloudformation events STACK`
217
+
218
+ Display the event listing of given stack. If the state of the
219
+ stack is "in progress", the polling option will result in
220
+ polling and displaying new events until the stack reaches a
221
+ completed state.
222
+
223
+ #### Supported options
224
+
225
+ * `--[no-]poll` poll for new events until completed state reached
226
+
227
+ ### `knife cloudformation describe STACK`
228
+
229
+ Display resources and outputs of give stack.
230
+
231
+ #### Supported options
232
+
233
+ * `--resources` display resources
234
+ * `--outputs` display outputs
235
+
236
+ ### `knife cloudformation inspect STACK`
237
+
238
+ The stack inspection command simply provides a proxy to the
239
+ underlying resource modeling objects provided via the
240
+ [miasma][miasma] library. It also provides extra helpers for
241
+ running common inspection commands.
242
+
243
+ ### Supported options
244
+
245
+ * `--nodes` list node addresses within stack
246
+ * `--instance-failure [LOG_FILE]` print log file from failed instance
247
+ * `--attribute ATTR` print stack attribute
248
+
249
+ #### `--nodes`
250
+
251
+ This option will return a list of compute instance IDs and
252
+ their addresses. The result will be a complete list including
253
+ direct compute resources within the stack as well as compute
254
+ resources that are part of auto scaling group resouces.
255
+
256
+ #### `--instance-failure [LOG_FILE]`
257
+
258
+ If the stack create or update failed due to a compute instance,
259
+ this option will attempt to locate the instance, connect to
260
+ it and download the defined log file. The default log file
261
+ is set to: `/var/log/chef/client.log`
262
+
263
+ #### `--attribute ATTR`
264
+
265
+ The attribute option is what provides the proxy to the underlying
266
+ [miasma][miasma] resource modeling. The value of `ATTR` is what should be
267
+ called on the `Miasma::Models::Orchestration::Stack` instance.
268
+ For example, to display the JSON template of a stack:
269
+
270
+ ```
271
+ $ knife cloudformation inspect STACK -a template
272
+ ```
273
+
274
+ To display the resource collection of the stack:
275
+
276
+ ```
277
+ $ knife cloudformation inspect STACK -a resources
278
+ ```
279
+
280
+ This will provide a list of resources. Now, to make this more
281
+ useful, we can start inspect specific resources. Lets assume
282
+ that the 3rd resource in the collection is an auto scaling
283
+ group resource. We can isolate that resource for display:
284
+
285
+ ```
286
+ $ knife cloudformation inspect STACK -a "resources.all.at(2)"
287
+ ```
288
+
289
+ Note that the resources are an array, and we are using a zero
290
+ based index. Now, this simply provides us with the information
291
+ we already have seen. One of the handy features within the
292
+ [miasma][miasma] library is the ability to expand supported resources.
293
+ So, we can expand this resource:
294
+
295
+ ```
296
+ $ knife cloudformation inspect STACK -a "resources.all.at(2).expand"
297
+ ```
298
+
299
+ This will expand the resource instance and return the actual
300
+ auto scaling group resource. The result will provide more detailed
301
+ information about the scaling group. But, perhaps we are looking
302
+ for the instances in this scaling group. The model instance we
303
+ now have (`Miasma::Orchestration::Models::AutoScale::Group`)
304
+ contains a `servers` attribute. The output lists the IDs of the
305
+ instances, but we can expand those as well:
306
+
307
+ ```
308
+ $ knife cloudformation inspect STACK -a "resources.all.at(2).expand.servers.map(&:expand)"
309
+ ```
310
+
311
+ The attribute string will be minimally processed when proxying calls
312
+ to the underlying models, which is why we are able to do ruby-ish
313
+ style things.
314
+
67
315
  # Info
68
316
 
69
317
  * Repository: https://github.com/hw-labs/knife-cloudformation
70
- * IRC: Freenode @ #heavywater
318
+ * IRC: Freenode @ #heavywater
319
+
320
+ [miasma]: http://miasma-rb.github.io/miasma/
@@ -38,7 +38,7 @@ module KnifeCloudformation
38
38
  bucket = provider.connection.api_for(:storage).buckets.get(
39
39
  Chef::Config[:knife][:cloudformation][:nesting_bucket]
40
40
  )
41
- if(options[:print_only])
41
+ if(config[:print_only])
42
42
  "http://example.com/bucket/#{name_args.first}_#{stack_name}.json"
43
43
  else
44
44
  unless(bucket)
@@ -1,4 +1,4 @@
1
1
  module KnifeCloudformation
2
2
  # Current library version
3
- VERSION = Gem::Version.new('0.2.16')
3
+ VERSION = Gem::Version.new('0.2.18')
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-cloudformation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.16
4
+ version: 0.2.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Roberts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-20 00:00:00.000000000 Z
11
+ date: 2015-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef