awscfn 1.2.0 → 1.3.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.
- package/README.md +2 -0
- package/bin/awscfn +12 -3
- package/dist/updateStack.d.ts +1 -1
- package/dist/updateStack.d.ts.map +1 -1
- package/dist/updateStack.js +9 -2
- package/dist/updateStack.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -127,6 +127,8 @@ awscfn update-stack -n <STACK_NAME> -t <TEMPLATE_FILE> -p <PARAMS_FILE>
|
|
|
127
127
|
| `--name`, `-n` | Stack name |
|
|
128
128
|
| `--template`, `-t` | CloudFormation template file |
|
|
129
129
|
| `--params`, `-p` | Parameters file (YAML) |
|
|
130
|
+
| `--create` | If the stack doesn't exist, create it (instead of erroring) |
|
|
131
|
+
| `-m` | Shorthand for `--create` |
|
|
130
132
|
|
|
131
133
|
If there are no changes to apply, the command succeeds gracefully:
|
|
132
134
|
```
|
package/bin/awscfn
CHANGED
|
@@ -91,6 +91,15 @@ const templateOpt = {
|
|
|
91
91
|
const paramsOpt = {
|
|
92
92
|
params: { type: 'string', alias: 'p', describe: 'Parameters file (YAML). Optional; omit to use template defaults.', demandOption: false },
|
|
93
93
|
};
|
|
94
|
+
const createIfMissingOpt = {
|
|
95
|
+
create: {
|
|
96
|
+
type: 'boolean',
|
|
97
|
+
alias: 'm',
|
|
98
|
+
describe: 'Create the stack if it does not exist (update-stack only)',
|
|
99
|
+
demandOption: false,
|
|
100
|
+
default: false,
|
|
101
|
+
},
|
|
102
|
+
};
|
|
94
103
|
const confirmOpt = {
|
|
95
104
|
confirm: { type: 'string', alias: 'c', describe: 'Repeat stack name to confirm deletion', demandOption: true },
|
|
96
105
|
};
|
|
@@ -156,9 +165,9 @@ yargs
|
|
|
156
165
|
.command(
|
|
157
166
|
'update-stack',
|
|
158
167
|
'Update a CloudFormation stack',
|
|
159
|
-
(cmd) => cmd.options({ ...nameOpt, ...templateOpt, ...paramsOpt }),
|
|
160
|
-
({ name, template, params }) => {
|
|
161
|
-
runCommand(() => updateStack(name, template, params));
|
|
168
|
+
(cmd) => cmd.options({ ...nameOpt, ...templateOpt, ...paramsOpt, ...createIfMissingOpt }),
|
|
169
|
+
({ name, template, params, create }) => {
|
|
170
|
+
runCommand(() => updateStack(name, template, params, Boolean(create)));
|
|
162
171
|
}
|
|
163
172
|
)
|
|
164
173
|
.command(
|
package/dist/updateStack.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* CLI handler: update an existing CloudFormation stack.
|
|
3
3
|
*/
|
|
4
|
-
export declare function updateStack(stackName: string, templatePath: string, paramsPath?: string): Promise<void>;
|
|
4
|
+
export declare function updateStack(stackName: string, templatePath: string, paramsPath?: string, create?: boolean): Promise<void>;
|
|
5
5
|
//# sourceMappingURL=updateStack.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateStack.d.ts","sourceRoot":"","sources":["../src/updateStack.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,wBAAsB,WAAW,CAC7B,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,UAAU,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"updateStack.d.ts","sourceRoot":"","sources":["../src/updateStack.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,wBAAsB,WAAW,CAC7B,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,UAAU,CAAC,EAAE,MAAM,EACnB,MAAM,GAAE,OAAe,GACxB,OAAO,CAAC,IAAI,CAAC,CA+Bf"}
|
package/dist/updateStack.js
CHANGED
|
@@ -41,12 +41,19 @@ const log_1 = require("./cli/log");
|
|
|
41
41
|
/**
|
|
42
42
|
* CLI handler: update an existing CloudFormation stack.
|
|
43
43
|
*/
|
|
44
|
-
async function updateStack(stackName, templatePath, paramsPath) {
|
|
44
|
+
async function updateStack(stackName, templatePath, paramsPath, create = false) {
|
|
45
45
|
cfn.initCloudFormationClient();
|
|
46
46
|
const { template, params } = await (0, loadTemplateAndParams_1.loadTemplateAndParams)(templatePath, paramsPath);
|
|
47
47
|
const existing = await cfn.getStackByName(stackName);
|
|
48
48
|
if (!existing) {
|
|
49
|
-
|
|
49
|
+
if (!create) {
|
|
50
|
+
throw new Error('stack not found, try create command');
|
|
51
|
+
}
|
|
52
|
+
console.log('validating template...');
|
|
53
|
+
await (0, validateTemplate_1.validateTemplateOrExit)(template);
|
|
54
|
+
(0, log_1.logStackAction)(stackName, 'creating', params);
|
|
55
|
+
await cfn.createStack(stackName, { body: template, params });
|
|
56
|
+
return;
|
|
50
57
|
}
|
|
51
58
|
console.log('validating template...');
|
|
52
59
|
await (0, validateTemplate_1.validateTemplateOrExit)(template);
|
package/dist/updateStack.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateStack.js","sourceRoot":"","sources":["../src/updateStack.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,
|
|
1
|
+
{"version":3,"file":"updateStack.js","sourceRoot":"","sources":["../src/updateStack.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,kCAoCC;AA5CD,+CAAiC;AACjC,uEAAkE;AAClE,6DAA8D;AAC9D,mCAAyC;AAEzC;;GAEG;AACI,KAAK,UAAU,WAAW,CAC7B,SAAiB,EACjB,YAAoB,EACpB,UAAmB,EACnB,SAAkB,KAAK;IAGvB,GAAG,CAAC,wBAAwB,EAAE,CAAC;IAE/B,MAAM,EAAC,QAAQ,EAAE,MAAM,EAAC,GAAG,MAAM,IAAA,6CAAqB,EAAC,YAAY,EAAE,UAAU,CAAC,CAAC;IACjF,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;IAErD,IAAI,CAAC,QAAQ,EAAE,CAAC;QAEZ,IAAI,CAAC,MAA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