@goldstack/utils-terraform 0.3.50 → 0.3.51

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.
@@ -1,74 +1,63 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.terraformCli = exports.infraCommands = exports.getVariablesFromProperties = exports.tf = void 0;
4
- const terraformBuild_1 = require("./terraformBuild");
5
- var terraformCli_1 = require("./terraformCli");
6
- Object.defineProperty(exports, "tf", { enumerable: true, get: function () { return terraformCli_1.tf; } });
7
- var terraformBuild_2 = require("./terraformBuild");
8
- Object.defineProperty(exports, "getVariablesFromProperties", { enumerable: true, get: function () { return terraformBuild_2.getVariablesFromProperties; } });
9
- const infraCommands = () => {
10
- const deploymentPositional = (yargs) => {
11
- return yargs.positional('deployment', {
12
- type: 'string',
13
- describe: 'Name of the deployment this command should be applied to',
14
- demandOption: true,
15
- });
16
- };
17
- return (yargs) => {
18
- return yargs
19
- .command('up <deployment>', 'Stands up infrastructure for the specified deployment', deploymentPositional)
20
- .command('init <deployment>', 'Initialises Terraform working directory for deployment', deploymentPositional)
21
- .command('plan <deployment>', 'Creates a Terraform execution plan for deployment', deploymentPositional)
22
- .command('apply <deployment>', 'Applies the last Terraform execution plan calculated using `infra plan`', deploymentPositional)
23
- .command('destroy <deployment>', 'DANGER: Destroys all deployed infrastructure for the deployment', (yargs) => {
24
- return deploymentPositional(yargs).option('yes', {
25
- alias: 'y',
26
- description: 'DANGER: If provided, confirmation for deleting infrastructure resources will be skipped.',
27
- default: false,
28
- demandOption: false,
29
- type: 'boolean',
30
- });
31
- })
32
- .command('upgrade <deployment> <targetVersion>', 'Upgrades Terraform version to a new target version (experimental)', (yargs) => {
33
- return deploymentPositional(yargs).positional('targetVersion', {
34
- type: 'string',
35
- description: 'Provides the target Terraform version that should be migrated to.',
36
- demandOption: true,
37
- });
38
- });
39
- };
40
- };
41
- exports.infraCommands = infraCommands;
42
- const terraformCli = (args, options) => {
43
- const [operation, ...opArgs] = args;
44
- const build = new terraformBuild_1.TerraformBuild(options.provider);
45
- if (operation === 'up') {
46
- build.init(opArgs);
47
- build.plan(opArgs);
48
- build.apply(opArgs);
49
- return;
50
- }
51
- if (operation === 'init') {
52
- build.init(opArgs);
53
- return;
54
- }
55
- if (operation === 'plan') {
56
- build.plan(opArgs);
57
- return;
58
- }
59
- if (operation === 'apply') {
60
- build.apply(opArgs);
61
- return;
62
- }
63
- if (operation === 'destroy') {
64
- build.destroy(opArgs);
65
- return;
66
- }
67
- if (operation === 'upgrade') {
68
- build.upgrade(opArgs);
69
- return;
70
- }
71
- throw new Error('Unknown infrastructure operation: ' + operation);
72
- };
73
- exports.terraformCli = terraformCli;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.terraformCli = exports.infraCommands = exports.getVariablesFromProperties = exports.tf = void 0;
4
+ const terraformBuild_1 = require("./terraformBuild");
5
+ var terraformCli_1 = require("./terraformCli");
6
+ Object.defineProperty(exports, "tf", { enumerable: true, get: function () { return terraformCli_1.tf; } });
7
+ var terraformBuild_2 = require("./terraformBuild");
8
+ Object.defineProperty(exports, "getVariablesFromProperties", { enumerable: true, get: function () { return terraformBuild_2.getVariablesFromProperties; } });
9
+ const infraCommands = () => {
10
+ const deploymentPositional = (yargs) => {
11
+ return yargs.positional('deployment', {
12
+ type: 'string',
13
+ describe: 'Name of the deployment this command should be applied to',
14
+ demandOption: true,
15
+ });
16
+ };
17
+ return (yargs) => {
18
+ return yargs
19
+ .command('up <deployment>', 'Stands up infrastructure for the specified deployment', deploymentPositional)
20
+ .command('init <deployment>', 'Initialises Terraform working directory for deployment', deploymentPositional)
21
+ .command('plan <deployment>', 'Creates a Terraform execution plan for deployment', deploymentPositional)
22
+ .command('apply <deployment>', 'Applies the last Terraform execution plan calculated using `infra plan`', deploymentPositional)
23
+ .command('destroy <deployment>', 'DANGER: Destroys all deployed infrastructure for the deployment', (yargs) => {
24
+ return deploymentPositional(yargs).option('yes', {
25
+ alias: 'y',
26
+ description: 'DANGER: If provided, confirmation for deleting infrastructure resources will be skipped.',
27
+ default: false,
28
+ demandOption: false,
29
+ type: 'boolean',
30
+ });
31
+ });
32
+ };
33
+ };
34
+ exports.infraCommands = infraCommands;
35
+ const terraformCli = (args, options) => {
36
+ const [operation, ...opArgs] = args;
37
+ const build = new terraformBuild_1.TerraformBuild(options.provider);
38
+ if (operation === 'up') {
39
+ build.init(opArgs);
40
+ build.plan(opArgs);
41
+ build.apply(opArgs);
42
+ return;
43
+ }
44
+ if (operation === 'init') {
45
+ build.init(opArgs);
46
+ return;
47
+ }
48
+ if (operation === 'plan') {
49
+ build.plan(opArgs);
50
+ return;
51
+ }
52
+ if (operation === 'apply') {
53
+ build.apply(opArgs);
54
+ return;
55
+ }
56
+ if (operation === 'destroy') {
57
+ build.destroy(opArgs);
58
+ return;
59
+ }
60
+ throw new Error('Unknown infrastructure operation: ' + operation);
61
+ };
62
+ exports.terraformCli = terraformCli;
74
63
  //# sourceMappingURL=utilsTerraform.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utilsTerraform.js","sourceRoot":"","sources":["../../src/utilsTerraform.ts"],"names":[],"mappings":";;;AAUA,qDAAkD;AAElD,+CAAoC;AAA3B,kGAAA,EAAE,OAAA;AACX,mDAA8D;AAArD,4HAAA,0BAA0B,OAAA;AAI5B,MAAM,aAAa,GAAG,GAAQ,EAAE;IACrC,MAAM,oBAAoB,GAAG,CAAC,KAAgB,EAAa,EAAE;QAC3D,OAAO,KAAK,CAAC,UAAU,CAAC,YAAY,EAAE;YACpC,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,0DAA0D;YACpE,YAAY,EAAE,IAAI;SACnB,CAAC,CAAC;IACL,CAAC,CAAC;IACF,OAAO,CAAC,KAAgB,EAAa,EAAE;QACrC,OAAO,KAAK;aACT,OAAO,CACN,iBAAiB,EACjB,uDAAuD,EACvD,oBAAoB,CACrB;aACA,OAAO,CACN,mBAAmB,EACnB,w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,CAAC,CAAC;QACnB,OAAO;KACR;IACD,IAAI,SAAS,KAAK,MAAM,EAAE;QACxB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnB,OAAO;KACR;IACD,IAAI,SAAS,KAAK,OAAO,EAAE;QACzB,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACpB,OAAO;KACR;IAED,IAAI,SAAS,KAAK,SAAS,EAAE;QAC3B,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACtB,OAAO;KACR;IAED,IAAI,SAAS,KAAK,SAAS,EAAE;QAC3B,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACtB,OAAO;KACR;IAED,MAAM,IAAI,KAAK,CAAC,oCAAoC,GAAG,SAAS,CAAC,CAAC;AACpE,CAAC,CAAC;AAvCW,QAAA,YAAY,gBAuCvB"}
1
+ {"version":3,"file":"utilsTerraform.js","sourceRoot":"","sources":["../../src/utilsTerraform.ts"],"names":[],"mappings":";;;AAUA,qDAAkD;AAElD,+CAAoC;AAA3B,kGAAA,EAAE,OAAA;AACX,mDAA8D;AAArD,4HAAA,0BAA0B,OAAA;AAI5B,MAAM,aAAa,GAAG,GAAQ,EAAE;IACrC,MAAM,oBAAoB,GAAG,CAAC,KAAgB,EAAa,EAAE;QAC3D,OAAO,KAAK,CAAC,UAAU,CAAC,YAAY,EAAE;YACpC,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,0DAA0D;YACpE,YAAY,EAAE,IAAI;SACnB,CAAC,CAAC;IACL,CAAC,CAAC;IACF,OAAO,CAAC,KAAgB,EAAa,EAAE;QACrC,OAAO,KAAK;aACT,OAAO,CACN,iBAAiB,EACjB,uDAAuD,EACvD,oBAAoB,CACrB;aACA,OAAO,CACN,mBAAmB,EACnB,wDAAwD,EACxD,oBAAoB,CACrB;aACA,OAAO,CACN,mBAAmB,EACnB,mDAAmD,EACnD,oBAAoB,CACrB;aACA,OAAO,CACN,oBAAoB,EACpB,yE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,GAAG,SAAS,CAAC,CAAC;AACpE,CAAC,CAAC;AAlCW,QAAA,YAAY,gBAkCvB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goldstack/utils-terraform",
3
- "version": "0.3.50",
3
+ "version": "0.3.51",
4
4
  "description": "Run Terraform commands easily as npm package scripts",
5
5
  "keywords": [
6
6
  "goldstack",