sfn 1.1.8 → 1.1.10
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/CHANGELOG.md +6 -0
- data/README.md +0 -127
- data/docs/commands.md +343 -0
- data/docs/configuration.md +91 -0
- data/docs/images/d_create.png +0 -0
- data/docs/images/d_create_prompt.png +0 -0
- data/docs/images/d_describe.png +0 -0
- data/docs/images/d_destroy.png +0 -0
- data/docs/images/d_diff.png +0 -0
- data/docs/images/d_events.png +0 -0
- data/docs/images/d_inspect-attribute.png +0 -0
- data/docs/images/d_inspect-nodes.png +0 -0
- data/docs/images/d_list.png +0 -0
- data/docs/images/d_update.png +0 -0
- data/docs/images/d_validate.png +0 -0
- data/lib/sfn/command/conf.rb +48 -0
- data/lib/sfn/command/update.rb +15 -1
- data/lib/sfn/command_module/base.rb +32 -19
- data/lib/sfn/config/conf.rb +6 -0
- data/lib/sfn/config/validate.rb +2 -1
- data/lib/sfn/planner/aws.rb +1 -2
- data/lib/sfn/provider.rb +1 -1
- data/lib/sfn/version.rb +1 -1
- metadata +15 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ee7d09945927cfc75821041ef90090dba2ef9c0
|
4
|
+
data.tar.gz: fad23bceb0be9ba52eab93f31e51d508c5109de1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adac24b09b2ab1681f88fc4c60d41fb21ca9026e4246527ff63a337c1300de2a8186cfab28b88df7599a2ae092206493ea29e053cd3d1e1dccd3b117844ae827
|
7
|
+
data.tar.gz: 55e2b6bdc3cbd30512c8818c2551f2c8253dfc2f5058b03b557816c2cdc8afe48e01c52f2ba2daa057e61b71e70a4791ddac17374b2a8c78bf084dbf7d021bc6
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## v1.1.10
|
2
|
+
* [enhancement] Better configuration related errors
|
3
|
+
* [fix] Planning display on stack removal (#75)
|
4
|
+
* [fix] Remove stack properties on update request (#76)
|
5
|
+
* [enhancement] Add `retries` config alias for `retry` (#77)
|
6
|
+
|
1
7
|
## v1.1.8
|
2
8
|
* [fix] Disable knife config mashing to get expected values (#72)
|
3
9
|
* [feature] Add new `conf` command (#72)
|
data/README.md
CHANGED
@@ -76,82 +76,6 @@ Configuration.new do
|
|
76
76
|
end
|
77
77
|
```
|
78
78
|
|
79
|
-
### Configuration Options
|
80
|
-
|
81
|
-
* `processing` - Enable SparkleFormation processing
|
82
|
-
* Valid: Boolean
|
83
|
-
* Default: `true`
|
84
|
-
|
85
|
-
* `apply_nesting` - Style of nested stack processing
|
86
|
-
* Valid: `"shallow"`, `"deep"`
|
87
|
-
* Default: `"deep"`
|
88
|
-
|
89
|
-
* `options` - API options for target orchestration API (see miasma)
|
90
|
-
* Valid: `Hash`
|
91
|
-
* Default: none
|
92
|
-
|
93
|
-
* `ssh_attempt_users` - List of users to attempt SSH connection on node failure
|
94
|
-
* Valid: `Array<String>`
|
95
|
-
* Default: none
|
96
|
-
|
97
|
-
* `identity_file` - Custom SSH identity file to use for connection on node failure
|
98
|
-
* Valid: `String`
|
99
|
-
* Default: none
|
100
|
-
|
101
|
-
* `nesting_bucket` - Name of bucket to store nested stack templates
|
102
|
-
* Valid: `String`
|
103
|
-
* Default: none
|
104
|
-
|
105
|
-
* `credentials` - API credentials for target orchestration API (see [miasma](https://github.com/miasma-rb/miasma))
|
106
|
-
* Valid: `Hash`
|
107
|
-
* Default: none
|
108
|
-
|
109
|
-
* `callbacks` - Callbacks to execute around API calls
|
110
|
-
* Valid: `Hash`
|
111
|
-
* Default: none
|
112
|
-
* `before` - Callbacks to execute before _any_ API call
|
113
|
-
* Valid: `Array<String>`
|
114
|
-
* Default: none
|
115
|
-
* `after` - Callbacks to execute after _any_ API call
|
116
|
-
* Valid: `Array<String>`
|
117
|
-
* Default: none
|
118
|
-
* `before_COMMAND` - Callbacks to execute before specific `COMMAND` API call
|
119
|
-
* Valid: `Array<String>`
|
120
|
-
* Default: none
|
121
|
-
* `after_COMMAND` - Callbacks to execute after specific `COMMAND` API call
|
122
|
-
* Valid: `Array<String>`
|
123
|
-
* Default: none
|
124
|
-
* `template` - Callbacks to execute on template
|
125
|
-
* Valid: `Array<String>`
|
126
|
-
* Default: none
|
127
|
-
* `default` - Callbacks to always execute
|
128
|
-
* Valid: `Array<String>`
|
129
|
-
* Default: none
|
130
|
-
* `require` - List of custom libraries to load
|
131
|
-
* Valid: `Array<String>`
|
132
|
-
* Default: none
|
133
|
-
|
134
|
-
* `retry` - Configuration of API request retries
|
135
|
-
* Valid: `Hash`
|
136
|
-
* Default: none
|
137
|
-
* `type` - Type of retry
|
138
|
-
* Valid: `"flat"`, `"linear"`, `"exponential"`
|
139
|
-
* Default: `"exponential"`
|
140
|
-
* `interval` - Base wait interval for retry
|
141
|
-
* Valid: `Numeric`
|
142
|
-
* Default: 5
|
143
|
-
* `max_attempts` - Maximum number of attempts allowed
|
144
|
-
* Valid: `Numeric`
|
145
|
-
* Default: 20
|
146
|
-
* _NOTE_: Set to `nil` for infinite retry
|
147
|
-
|
148
|
-
* `stack_types` - Valid stack resource types
|
149
|
-
* Valid: `Array<String>`
|
150
|
-
* Default: `[DEFAULT_PROVIDER_TYPE]`
|
151
|
-
|
152
|
-
* `locations` - API credentials for named locations
|
153
|
-
* Valid: `Hash`
|
154
|
-
* Default: none
|
155
79
|
|
156
80
|
## Commands
|
157
81
|
|
@@ -179,57 +103,6 @@ Validates template with API
|
|
179
103
|
|
180
104
|
Creates a new stack with the provided name (`NAME`).
|
181
105
|
|
182
|
-
#### Apply Stacks
|
183
|
-
|
184
|
-
The `--apply-stack` option allows providing the name of an existing
|
185
|
-
stack when creating or updating. Applying stacks is simply fetching
|
186
|
-
the outputs from the applied stacks and automatically defaulting the
|
187
|
-
set parameter of the new or updated stack. Outputs are matched
|
188
|
-
by name to the parameters of the target stack. This allows an easy
|
189
|
-
way to use values from existing stacks when building new stacks.
|
190
|
-
|
191
|
-
Example:
|
192
|
-
|
193
|
-
StackA:
|
194
|
-
|
195
|
-
```json
|
196
|
-
...
|
197
|
-
"Outputs": {
|
198
|
-
"LoadBalancerAddress": {
|
199
|
-
"Description": "Address of Load Balancer",
|
200
|
-
"Value": {
|
201
|
-
"Fn::GetAtt": [
|
202
|
-
"LoadBalancerResource",
|
203
|
-
"DNSName"
|
204
|
-
]
|
205
|
-
}
|
206
|
-
}
|
207
|
-
}
|
208
|
-
...
|
209
|
-
```
|
210
|
-
|
211
|
-
StackB:
|
212
|
-
|
213
|
-
```json
|
214
|
-
...
|
215
|
-
"Parameters": {
|
216
|
-
"LoadBalancerAddress": {
|
217
|
-
"Type": "String",
|
218
|
-
"Default": "unset"
|
219
|
-
}
|
220
|
-
}
|
221
|
-
...
|
222
|
-
```
|
223
|
-
|
224
|
-
When creating StackB, if we use the `--apply-stack` option:
|
225
|
-
|
226
|
-
```
|
227
|
-
$ sfn create StackB --apply-stack StackA
|
228
|
-
```
|
229
|
-
|
230
|
-
when prompted for the stack parameters, we will find the parameter
|
231
|
-
value for `LoadBalancerAddress` to be filled in with the output
|
232
|
-
provided from StackA.
|
233
106
|
|
234
107
|
#### Processing
|
235
108
|
|
data/docs/commands.md
ADDED
@@ -0,0 +1,343 @@
|
|
1
|
+
---
|
2
|
+
title: "Commands"
|
3
|
+
weight: 4
|
4
|
+
anchors:
|
5
|
+
- title: "Lifecycle commands"
|
6
|
+
url: "#lifecycle-commands"
|
7
|
+
- title: "Inspection and Information commands"
|
8
|
+
url: "#inspection-and-information-commands"
|
9
|
+
- title: "Configuration commands"
|
10
|
+
url: "#configuration-commands"
|
11
|
+
---
|
12
|
+
|
13
|
+
## SparkleFormation CLI commands
|
14
|
+
|
15
|
+
The `sfn` command provides a collection of subcommands to handle stack
|
16
|
+
lifecycles as well as subcommands to aid in inspection of existing
|
17
|
+
stacks.
|
18
|
+
|
19
|
+
### Lifecycle commands
|
20
|
+
|
21
|
+
#### Stack create
|
22
|
+
|
23
|
+
Stacks can be created via `sfn` using SparkleFormation templates or raw JSON
|
24
|
+
templates.
|
25
|
+
|
26
|
+
~~~
|
27
|
+
$ sfn create my-stack
|
28
|
+
~~~
|
29
|
+
|
30
|
+
`sfn` will prompt for selection of a template to build for this new stack. To
|
31
|
+
disable this prompting behavior, you can provide the path or name of the desired
|
32
|
+
template:
|
33
|
+
|
34
|
+
~~~
|
35
|
+
$ sfn create my-stack --file my_template
|
36
|
+
~~~
|
37
|
+
|
38
|
+
By default `sfn` will process and build SparkleFormation templates. To build a JSON
|
39
|
+
template, disable processing in the configuration file, or via flag:
|
40
|
+
|
41
|
+
~~~
|
42
|
+
$ sfn create my-stack --file ./my_template.json --no-processing
|
43
|
+
~~~
|
44
|
+
|
45
|
+
The `create` command is only responsible for initiating the stack creation with the
|
46
|
+
remote provider API. This does not report back the success or failure of the actual
|
47
|
+
stack creation. To provide this behavior, the `create` command will automatically poll
|
48
|
+
the stack's resource events. Once the stack as reached a completed state, the `create`
|
49
|
+
command can properly notify of a _success_ or _failed_ state and exit with the proper
|
50
|
+
status code. The automatic polling behavior can be disabled:
|
51
|
+
|
52
|
+
~~~
|
53
|
+
$ sfn create my-stack --file my_template --no-poll
|
54
|
+
~~~
|
55
|
+
|
56
|
+
The `--apply-stack` option allows providing the name of an existing
|
57
|
+
stack when creating or updating. Applying stacks is simply fetching
|
58
|
+
the outputs from the applied stacks and automatically defaulting the
|
59
|
+
set parameter of the new or updated stack. Outputs are matched
|
60
|
+
by name to the parameters of the target stack. This allows an easy
|
61
|
+
way to use values from existing stacks when building new stacks.
|
62
|
+
|
63
|
+
Example:
|
64
|
+
|
65
|
+
StackA:
|
66
|
+
|
67
|
+
~~~json
|
68
|
+
...
|
69
|
+
"Outputs": {
|
70
|
+
"LoadBalancerAddress": {
|
71
|
+
"Description": "Address of Load Balancer",
|
72
|
+
"Value": {
|
73
|
+
"Fn::GetAtt": [
|
74
|
+
"LoadBalancerResource",
|
75
|
+
"DNSName"
|
76
|
+
]
|
77
|
+
}
|
78
|
+
}
|
79
|
+
}
|
80
|
+
...
|
81
|
+
~~~
|
82
|
+
|
83
|
+
StackB:
|
84
|
+
|
85
|
+
~~~json
|
86
|
+
...
|
87
|
+
"Parameters": {
|
88
|
+
"LoadBalancerAddress": {
|
89
|
+
"Type": "String",
|
90
|
+
"Default": "unset"
|
91
|
+
}
|
92
|
+
}
|
93
|
+
...
|
94
|
+
~~~
|
95
|
+
|
96
|
+
When creating StackB, if we use the `--apply-stack` option:
|
97
|
+
|
98
|
+
~~~
|
99
|
+
$ sfn create StackB --apply-stack StackA
|
100
|
+
~~~
|
101
|
+
|
102
|
+
when prompted for the stack parameters, we will find the parameter
|
103
|
+
value for `LoadBalancerAddress` to be filled in with the output
|
104
|
+
provided from StackA.
|
105
|
+
|
106
|
+
Example of stack creation:
|
107
|
+
|
108
|
+

|
109
|
+
|
110
|
+
#### Stack update
|
111
|
+
|
112
|
+
Existing stacks can be updated via `sfn`:
|
113
|
+
|
114
|
+
~~~
|
115
|
+
$ sfn update my-stack
|
116
|
+
~~~
|
117
|
+
|
118
|
+
This will start an "in place" update. Only the parameters of the stack are updated. To
|
119
|
+
update the template of the stack as well:
|
120
|
+
|
121
|
+
~~~
|
122
|
+
$ sfn update my-stack --file my_template
|
123
|
+
~~~
|
124
|
+
|
125
|
+
The `update` command behaves like the `create` command. It is only responsible for initiating
|
126
|
+
the request with the remote provider API. It will poll the stack events to detect final stack
|
127
|
+
state. The polling can be disabled:
|
128
|
+
|
129
|
+
~~~
|
130
|
+
$ sfn update my-stack --file my_template --no-poll
|
131
|
+
~~~
|
132
|
+
|
133
|
+
Example of stack update:
|
134
|
+
|
135
|
+

|
136
|
+
|
137
|
+
#### Stack destroy
|
138
|
+
|
139
|
+
Existing stacks can be destroyed via `sfn`:
|
140
|
+
|
141
|
+
~~~
|
142
|
+
$ sfn destroy my-stack
|
143
|
+
~~~
|
144
|
+
|
145
|
+
By default a confirmation prompt will be provided prior to destroying an existing stack.
|
146
|
+
This can be disabled by automatically confirming:
|
147
|
+
|
148
|
+
~~~
|
149
|
+
$ sfn destroy my-stack --yes
|
150
|
+
~~~
|
151
|
+
|
152
|
+
The `destroy` command will poll the stack resource events until the stack has been successfully
|
153
|
+
deleted, or has reached a "complete" state (which would indicate a failure to destroy). The polling
|
154
|
+
can be disabled:
|
155
|
+
|
156
|
+
~~~
|
157
|
+
$ sfn destroy my-stack --yes --no-poll
|
158
|
+
~~~
|
159
|
+
|
160
|
+
The `destroy` command also provides glob support when specifying stack names. This can make cleanup
|
161
|
+
very easy when multiple testing stacks may exist:
|
162
|
+
|
163
|
+
~~~
|
164
|
+
$ sfn destroy my-stack-*
|
165
|
+
~~~
|
166
|
+
|
167
|
+
This will destroy all stacks whose name start with `my-stack-`. The command will prompt for confirmation
|
168
|
+
and provide a list of all matching stacks prior to destruction.
|
169
|
+
|
170
|
+
Example of stack destroy:
|
171
|
+
|
172
|
+

|
173
|
+
|
174
|
+
### Inspection and Information commands
|
175
|
+
|
176
|
+
#### Stack list
|
177
|
+
|
178
|
+
To list existing stacks:
|
179
|
+
|
180
|
+
~~~
|
181
|
+
$ sfn list
|
182
|
+
~~~
|
183
|
+
|
184
|
+
Example of a stack list:
|
185
|
+
|
186
|
+

|
187
|
+
|
188
|
+
#### Stack describe
|
189
|
+
|
190
|
+
A description of an existing stack will display resources allocated to the stack and any outputs
|
191
|
+
that were defined within the stack's template:
|
192
|
+
|
193
|
+
~~~
|
194
|
+
$ sfn describe my-stack
|
195
|
+
~~~
|
196
|
+
|
197
|
+
If the stack contains nested stacks, it will display the resources and outputs for those stacks
|
198
|
+
as well.
|
199
|
+
|
200
|
+
To describe only resources:
|
201
|
+
|
202
|
+
~~~
|
203
|
+
$ sfn describe my-stack --resources
|
204
|
+
~~~
|
205
|
+
|
206
|
+
To describe only outputs:
|
207
|
+
|
208
|
+
~~~
|
209
|
+
$ sfn describe my-stack --outputs
|
210
|
+
~~~
|
211
|
+
|
212
|
+
Example of a stack describe:
|
213
|
+
|
214
|
+

|
215
|
+
|
216
|
+
#### Stack events
|
217
|
+
|
218
|
+
List the events genereted by the resources allocated to an existing stack:
|
219
|
+
|
220
|
+
~~~
|
221
|
+
$ sfn events my-stack
|
222
|
+
~~~
|
223
|
+
|
224
|
+
If the resources within the stack are currently being modified (via a `create`, `update`, or `destroy`)
|
225
|
+
command, the events can be polled until the stack reaches a completed state:
|
226
|
+
|
227
|
+
~~~
|
228
|
+
$ sfn events my-stack --poll
|
229
|
+
~~~
|
230
|
+
|
231
|
+
Example of stack events:
|
232
|
+
|
233
|
+

|
234
|
+
|
235
|
+
#### Stack inspection
|
236
|
+
|
237
|
+
Existing stacks can have their resources inspected via `sfn` using the miasma model API. The `inspect`
|
238
|
+
command provides the ability to directly access resource information where the miasma library has
|
239
|
+
modeling support enabled.
|
240
|
+
|
241
|
+
One builtin helper for the `inspect` command is listing all compute resources available within a stack.
|
242
|
+
This includes standalone compute instances as well as compute instances attached to auto-scaling groups
|
243
|
+
defined within the stack.
|
244
|
+
|
245
|
+
~~~
|
246
|
+
$ sfn inspect my-stack --nodes
|
247
|
+
~~~
|
248
|
+
|
249
|
+
Example of stack node inspection:
|
250
|
+
|
251
|
+

|
252
|
+
|
253
|
+
When run with no options, the `inspect` command will output the data model information of the stack:
|
254
|
+
|
255
|
+
~~~
|
256
|
+
$ sfn inspect my-stack
|
257
|
+
~~~
|
258
|
+
|
259
|
+
Individual items can be displayed using the attribute flag:
|
260
|
+
|
261
|
+
~~~
|
262
|
+
$ sfn inspect my-stack --attribute template
|
263
|
+
~~~
|
264
|
+
|
265
|
+
The attribute flag is gets applied to the miasma data model and will output the result of request. For
|
266
|
+
example, if the stack consisted of one resource, and that resource was a compute instance, we could view
|
267
|
+
the resource information from the orchestration API point of view:
|
268
|
+
|
269
|
+
~~~
|
270
|
+
$ sfn inspect my-stack --attribute "resources.all.first"
|
271
|
+
~~~
|
272
|
+
|
273
|
+
The information here will be sparse because the orchestration API only keeps a reference to the actual
|
274
|
+
resource within its own system. Because the miasma library has compute modeling defined, we can utilize
|
275
|
+
the library to automatically load the compute instance:
|
276
|
+
|
277
|
+
~~~
|
278
|
+
$ sfn inspect my-stack --attribute "resources.all.first.expand"
|
279
|
+
~~~
|
280
|
+
|
281
|
+
If only the addresses allocated to the compute instance were desired, that can be requested:
|
282
|
+
|
283
|
+
~~~
|
284
|
+
$ sfn inspect my-stack --attribute "resources.all.first.expand.addresses"
|
285
|
+
~~~
|
286
|
+
|
287
|
+
Example of stack attribute inspection
|
288
|
+
|
289
|
+

|
290
|
+
|
291
|
+
#### Template print
|
292
|
+
|
293
|
+
To display a generated template:
|
294
|
+
|
295
|
+
~~~
|
296
|
+
$ sfn print --file my_template
|
297
|
+
~~~
|
298
|
+
|
299
|
+
#### Template validation
|
300
|
+
|
301
|
+
Templates can be validated with the remote provide API prior to creation:
|
302
|
+
|
303
|
+
~~~
|
304
|
+
$ sfn validate --file my_template
|
305
|
+
~~~
|
306
|
+
|
307
|
+
If the template is a JSON style template, disable processing:
|
308
|
+
|
309
|
+
~~~
|
310
|
+
$ sfn validate --file my_template --no-processing
|
311
|
+
~~~
|
312
|
+
|
313
|
+
Example of stack validate:
|
314
|
+
|
315
|
+

|
316
|
+
|
317
|
+
#### Template diff
|
318
|
+
|
319
|
+
Template updates can be diff'ed against an existing stack's template to display information about
|
320
|
+
what resource modifications will be introduced by the new template:
|
321
|
+
|
322
|
+
~~~
|
323
|
+
$ sfn diff my-stack --file my_template
|
324
|
+
~~~
|
325
|
+
|
326
|
+
Example of stack diff:
|
327
|
+
|
328
|
+

|
329
|
+
|
330
|
+
### Configuration commands
|
331
|
+
|
332
|
+
To aid setup and configuration, `sfn` provides a configuration helper:
|
333
|
+
|
334
|
+
~~~
|
335
|
+
$ sfn conf
|
336
|
+
~~~
|
337
|
+
|
338
|
+
This will display the current configuration. If no configuration file is present, the user can have
|
339
|
+
one automatically generated for them:
|
340
|
+
|
341
|
+
~~~
|
342
|
+
$ sfn conf --generate
|
343
|
+
~~~
|
data/docs/configuration.md
CHANGED
@@ -6,6 +6,8 @@ anchors:
|
|
6
6
|
url: "#sfn-based"
|
7
7
|
- title: "knife-based"
|
8
8
|
url: "#knife-based"
|
9
|
+
- title: "configuration-options"
|
10
|
+
url: "#configuration-options"
|
9
11
|
---
|
10
12
|
|
11
13
|
|
@@ -43,4 +45,93 @@ can be accessed via:
|
|
43
45
|
$ knife sparkleformation --help
|
44
46
|
~~~
|
45
47
|
|
48
|
+
### Configuration Options
|
49
|
+
|
50
|
+
| Option | Attribute | Value
|
51
|
+
|----------------------------|---------------|---------------------------------------------------------------
|
52
|
+
| `processing` | Description | Enable SparkleFormation processing
|
53
|
+
| | Valid | `TrueClass`, `FalseClass`
|
54
|
+
| | Default | `true`
|
55
|
+
|----------------------------|---------------|---------------------------------------------------------------
|
56
|
+
| `apply_nesting` | Description | Style of nested stack processing
|
57
|
+
| | Valid | `"shallow"`, `"deep"`
|
58
|
+
| | Default | `"deep"`
|
59
|
+
|----------------------------|---------------|---------------------------------------------------------------
|
60
|
+
| `options` | Description | API options for target API (see miasma)
|
61
|
+
| | Valid | `Hash`
|
62
|
+
| | Default | none
|
63
|
+
|----------------------------|---------------|---------------------------------------------------------------
|
64
|
+
| `ssh_attempt_users` | Description | List of users to attempt SSH connection on node failure
|
65
|
+
| | Valid | `Array<String>`
|
66
|
+
| | Default | none
|
67
|
+
|----------------------------|---------------|---------------------------------------------------------------
|
68
|
+
| `identity_file` | Description | Custom SSH identity file for node failure connection
|
69
|
+
| | Valid | `String`
|
70
|
+
| | Default | none
|
71
|
+
|----------------------------|---------------|---------------------------------------------------------------
|
72
|
+
| `nesting_bucket` | Description | Name of bucket to store nested stack templates
|
73
|
+
| | Valid | `String`
|
74
|
+
| | Default | none
|
75
|
+
|----------------------------|---------------|---------------------------------------------------------------
|
76
|
+
| `credentials` | Description | API credentials for target orchestration API
|
77
|
+
| | Valid | `Hash`
|
78
|
+
| | Default | none
|
79
|
+
|----------------------------|---------------|---------------------------------------------------------------
|
80
|
+
| `callbacks` | Description | Callbacks to execute around API calls
|
81
|
+
| | Valid | `Hash`
|
82
|
+
| | Default | none
|
83
|
+
|----------------------------|---------------|---------------------------------------------------------------
|
84
|
+
| `callbacks.before` | Description | Callbacks to execute before _any_ API call
|
85
|
+
| | Valid | `Array<String>`
|
86
|
+
| | Default | none
|
87
|
+
|----------------------------|---------------|---------------------------------------------------------------
|
88
|
+
| `callbacks.after` | Description | Callbacks to execute after _any_ API call
|
89
|
+
| | Valid | `Array<String>`
|
90
|
+
| | Default | none
|
91
|
+
|----------------------------|---------------|---------------------------------------------------------------
|
92
|
+
| `callbacks.before_COMMAND` | Description | Callbacks to execute before specific `COMMAND` API call
|
93
|
+
| | Valid | `Array<String>`
|
94
|
+
| | Default | none
|
95
|
+
|----------------------------|---------------|---------------------------------------------------------------
|
96
|
+
| `callbacks.after_COMMAND` | Description | Callbacks to execute after specific `COMMAND` API call
|
97
|
+
| | Valid | `Array<String>`
|
98
|
+
| | Default | none
|
99
|
+
|----------------------------|---------------|---------------------------------------------------------------
|
100
|
+
| `callbacks.template` | Description | Callbacks to execute on template
|
101
|
+
| | Valid | `Array<String>`
|
102
|
+
| | Default | none
|
103
|
+
|----------------------------|---------------|---------------------------------------------------------------
|
104
|
+
| `callbacks.default` | Description | Callbacks to always execute
|
105
|
+
| | Valid | `Array<String>`
|
106
|
+
| | Default | none
|
107
|
+
|----------------------------|---------------|---------------------------------------------------------------
|
108
|
+
| `callbacks.require` | Description | List of custom libraries to load
|
109
|
+
| | Valid | `Array<String>`
|
110
|
+
| | Default | none
|
111
|
+
|----------------------------|---------------|---------------------------------------------------------------
|
112
|
+
| `retries` | Description | Configuration of API request retries
|
113
|
+
| | Valid | `Hash`
|
114
|
+
| | Default | none
|
115
|
+
|----------------------------|---------------|---------------------------------------------------------------
|
116
|
+
| `retries.type` | Description | Retry implementation
|
117
|
+
| | Valid | `"flat"`, `"linear"`, `"exponential"`
|
118
|
+
| | Default | `"exponential"`
|
119
|
+
|----------------------------|---------------|---------------------------------------------------------------
|
120
|
+
| `retries.interval` | Description | Base wait interval for retry
|
121
|
+
| | Valid | `Numeric`
|
122
|
+
| | Default | `5`
|
123
|
+
|----------------------------|---------------|---------------------------------------------------------------
|
124
|
+
| `retries.max_attempts` | Description | Maximum number of attempts allowed (`nil` for infinite retry)
|
125
|
+
| | Valid | `Numeric`, `NilClass`
|
126
|
+
| | Default | `20`
|
127
|
+
|----------------------------|---------------|---------------------------------------------------------------
|
128
|
+
| `stack_types` | Description | Define customized stack resource types
|
129
|
+
| | Valid | `Array<String>`
|
130
|
+
| | Default | `[DEFAULT_PROVIDER_TYPE]`
|
131
|
+
|----------------------------|---------------|---------------------------------------------------------------
|
132
|
+
| `locations` | Description | API credentials for named locations (JackalStack resources)
|
133
|
+
| | Valid | `Hash`
|
134
|
+
| | Default | none
|
135
|
+
|----------------------------|---------------|---------------------------------------------------------------
|
136
|
+
|
46
137
|
[knife]: https://docs.chef.io/knife.html
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/sfn/command/conf.rb
CHANGED
@@ -14,6 +14,25 @@ module Sfn
|
|
14
14
|
format_value(config[k], ' ')
|
15
15
|
end
|
16
16
|
end
|
17
|
+
if(config[:generate])
|
18
|
+
ui.puts
|
19
|
+
ui.info 'Generating .sfn configuration file..'
|
20
|
+
generate_config!
|
21
|
+
ui.info "Generation of .sfn configuration file #{ui.color('complete!', :green, :bold)}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def generate_config!
|
26
|
+
if(File.exists?('.sfn'))
|
27
|
+
ui.warn 'Existing .sfn configuration file detected!'
|
28
|
+
ui.confirm 'Overwrite current .sfn configuration file?'
|
29
|
+
end
|
30
|
+
run_action 'Writing .sfn file' do
|
31
|
+
File.open('.sfn', 'w') do |file|
|
32
|
+
file.write SFN_CONFIG_CONTENTS
|
33
|
+
end
|
34
|
+
nil
|
35
|
+
end
|
17
36
|
end
|
18
37
|
|
19
38
|
def format_value(value, indent='')
|
@@ -34,6 +53,35 @@ module Sfn
|
|
34
53
|
end
|
35
54
|
end
|
36
55
|
|
56
|
+
SFN_CONFIG_CONTENTS = <<-EOF
|
57
|
+
# This is an auto-generated configuration file for
|
58
|
+
# the sfn CLI. To view all available configuration
|
59
|
+
# options, please see:
|
60
|
+
# http://www.sparkleformation.io/docs/sfn/configuration.html
|
61
|
+
Configuration.new do
|
62
|
+
apply_nesting 'deep'
|
63
|
+
processing true
|
64
|
+
options do
|
65
|
+
on_failure 'nothing'
|
66
|
+
notification_topics []
|
67
|
+
capabilities ['CAPABILITY_IAM']
|
68
|
+
tags do
|
69
|
+
creator ENV['USER']
|
70
|
+
end
|
71
|
+
end
|
72
|
+
# nesting_bucket 'BUCKET_NAME'
|
73
|
+
credentials do
|
74
|
+
provider :aws
|
75
|
+
aws_access_key_id ENV['AWS_ACCESS_KEY_ID']
|
76
|
+
aws_secret_access_key ENV['AWS_SECRET_ACCESS_KEY']
|
77
|
+
aws_region ENV['AWS_REGION']
|
78
|
+
aws_bucket_region ENV['AWS_REGION']
|
79
|
+
# aws_sts_role_arn ENV['AWS_STS_ROLE_ARN']
|
80
|
+
end
|
81
|
+
end
|
82
|
+
EOF
|
83
|
+
|
84
|
+
|
37
85
|
end
|
38
86
|
end
|
39
87
|
end
|
data/lib/sfn/command/update.rb
CHANGED
@@ -97,7 +97,7 @@ module Sfn
|
|
97
97
|
end
|
98
98
|
|
99
99
|
stack.parameters = config_root_parameters
|
100
|
-
stack.template =
|
100
|
+
stack.template = scrub_template(update_template)
|
101
101
|
else
|
102
102
|
apply_stacks!(stack)
|
103
103
|
|
@@ -240,6 +240,20 @@ module Sfn
|
|
240
240
|
end
|
241
241
|
end
|
242
242
|
|
243
|
+
# Scrub sparkle/sfn customizations from the stack resource data
|
244
|
+
#
|
245
|
+
# @param template [Hash]
|
246
|
+
# @return [Hash]
|
247
|
+
def scrub_template(template)
|
248
|
+
template = Sfn::Utils::StackParameterScrubber.scrub!(template)
|
249
|
+
(template['Resources'] || {}).each do |r_name, r_content|
|
250
|
+
if(valid_stack_types.include?(r_content['Type']))
|
251
|
+
(r_content['Properties'] || {}).delete('Stack')
|
252
|
+
end
|
253
|
+
end
|
254
|
+
template
|
255
|
+
end
|
256
|
+
|
243
257
|
end
|
244
258
|
end
|
245
259
|
end
|
@@ -8,6 +8,11 @@ module Sfn
|
|
8
8
|
# Instance methods for cloudformation command classes
|
9
9
|
module InstanceMethods
|
10
10
|
|
11
|
+
# @return [Array<String>]
|
12
|
+
def valid_stack_types
|
13
|
+
provider.connection.data[:stack_types]
|
14
|
+
end
|
15
|
+
|
11
16
|
# @return [Array<String>]
|
12
17
|
def custom_stack_types
|
13
18
|
[config.fetch(:stack_types, [])].flatten.compact
|
@@ -15,25 +20,33 @@ module Sfn
|
|
15
20
|
|
16
21
|
# @return [KnifeCloudformation::Provider]
|
17
22
|
def provider
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
[
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
23
|
+
begin
|
24
|
+
memoize(:provider, :direct) do
|
25
|
+
result = Sfn::Provider.new(
|
26
|
+
:miasma => config[:credentials],
|
27
|
+
:async => false,
|
28
|
+
:fetch => false
|
29
|
+
)
|
30
|
+
result.connection.data[:stack_types] = (
|
31
|
+
[
|
32
|
+
result.connection.class.const_get(:RESOURCE_MAPPING).detect do |klass, info|
|
33
|
+
info[:api] == :orchestration
|
34
|
+
end.first
|
35
|
+
] + custom_stack_types
|
36
|
+
).compact.uniq
|
37
|
+
retry_config = config.fetch(:retry,
|
38
|
+
config.fetch(:retries, {})
|
39
|
+
)
|
40
|
+
result.connection.data[:retry_ui] = ui
|
41
|
+
result.connection.data[:locations] = config.fetch(:locations, {})
|
42
|
+
result.connection.data[:retry_type] = retry_config.fetch(:type, :exponential)
|
43
|
+
result.connection.data[:retry_interval] = retry_config.fetch(:interval, 5)
|
44
|
+
result.connection.data[:retry_max] = retry_config.fetch(:max_attempts, 20)
|
45
|
+
result
|
46
|
+
end
|
47
|
+
rescue
|
48
|
+
ui.error 'Failed to create remote API connection. Please validate configuration!'
|
49
|
+
raise
|
37
50
|
end
|
38
51
|
end
|
39
52
|
|
data/lib/sfn/config/conf.rb
CHANGED
@@ -4,6 +4,12 @@ module Sfn
|
|
4
4
|
class Config
|
5
5
|
# Config command configuration (subclass create to get all the configs)
|
6
6
|
class Conf < Create
|
7
|
+
|
8
|
+
attribute(
|
9
|
+
:generate, [TrueClass, FalseClass],
|
10
|
+
:description => 'Generate a basic configuration file'
|
11
|
+
)
|
12
|
+
|
7
13
|
end
|
8
14
|
end
|
9
15
|
end
|
data/lib/sfn/config/validate.rb
CHANGED
data/lib/sfn/planner/aws.rb
CHANGED
@@ -243,9 +243,8 @@ module Sfn
|
|
243
243
|
n_exists = is_stack?(update_template['Resources'].fetch(n_name, {})['Type'])
|
244
244
|
n_template = update_template['Resources'].fetch(n_name, {}).fetch('Properties', {})['Stack']
|
245
245
|
n_parameters = update_template['Resources'].fetch(n_name, {}).fetch('Properties', {})['Parameters']
|
246
|
-
n_type = update_template['Resources'].fetch(n_name, {})
|
246
|
+
n_type = update_template['Resources'].fetch(n_name, {})['Type'] ||
|
247
247
|
origin_template['Resources'][n_name]['Type']
|
248
|
-
)
|
249
248
|
resource = Smash.new(
|
250
249
|
:name => n_name,
|
251
250
|
:type => n_type,
|
data/lib/sfn/provider.rb
CHANGED
@@ -41,7 +41,7 @@ module Sfn
|
|
41
41
|
def initialize(args={})
|
42
42
|
args = args.to_smash
|
43
43
|
unless(args.get(:miasma, :provider))
|
44
|
-
best_guess = args
|
44
|
+
best_guess = (args[:miasma] || {}).keys.group_by do |key|
|
45
45
|
key.to_s.split('_').first
|
46
46
|
end.sort do |x, y|
|
47
47
|
y.size <=> x.size
|
data/lib/sfn/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sfn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.10
|
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-11-
|
11
|
+
date: 2015-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bogo-cli
|
@@ -108,7 +108,19 @@ files:
|
|
108
108
|
- bin/sfn
|
109
109
|
- docs/README.md
|
110
110
|
- docs/callbacks.md
|
111
|
+
- docs/commands.md
|
111
112
|
- docs/configuration.md
|
113
|
+
- docs/images/d_create.png
|
114
|
+
- docs/images/d_create_prompt.png
|
115
|
+
- docs/images/d_describe.png
|
116
|
+
- docs/images/d_destroy.png
|
117
|
+
- docs/images/d_diff.png
|
118
|
+
- docs/images/d_events.png
|
119
|
+
- docs/images/d_inspect-attribute.png
|
120
|
+
- docs/images/d_inspect-nodes.png
|
121
|
+
- docs/images/d_list.png
|
122
|
+
- docs/images/d_update.png
|
123
|
+
- docs/images/d_validate.png
|
112
124
|
- docs/overview.md
|
113
125
|
- docs/usage.md
|
114
126
|
- docs/v/0.3.2/marked.js
|
@@ -209,3 +221,4 @@ signing_key:
|
|
209
221
|
specification_version: 4
|
210
222
|
summary: SparkleFormation CLI
|
211
223
|
test_files: []
|
224
|
+
has_rdoc:
|