@storm-software/terraform-tools 0.56.1 → 0.57.1

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.
Files changed (45) hide show
  1. package/.eslintrc.json +35 -0
  2. package/CHANGELOG.md +33 -0
  3. package/README.md +1 -1
  4. package/dist/{chunk-L3RPHNAE.mjs → chunk-67CRAPR7.mjs} +17 -10
  5. package/dist/{chunk-N5AGYIJO.js → chunk-QWYUK6DV.js} +7 -0
  6. package/dist/executors.js +1 -1
  7. package/dist/executors.mjs +1 -1
  8. package/dist/generators.js +2 -2
  9. package/dist/generators.mjs +1 -1
  10. package/dist/index.js +5 -5
  11. package/dist/index.mjs +4 -4
  12. package/dist/src/generators/init/init.js +2 -2
  13. package/dist/src/generators/init/init.mjs +1 -1
  14. package/executors.ts +8 -0
  15. package/generators.ts +2 -0
  16. package/index.ts +3 -0
  17. package/package.json +1 -1
  18. package/project.json +57 -0
  19. package/src/base/base-terraform-executor.untyped.ts +90 -0
  20. package/src/base/index.ts +2 -0
  21. package/src/base/terraform-executor.ts +101 -0
  22. package/src/executors/apply/executor.spec.ts +18 -0
  23. package/src/executors/apply/executor.ts +4 -0
  24. package/src/executors/destroy/executor.spec.ts +18 -0
  25. package/src/executors/destroy/executor.ts +4 -0
  26. package/src/executors/output/executor.spec.ts +18 -0
  27. package/src/executors/output/executor.ts +4 -0
  28. package/src/executors/plan/executor.spec.ts +18 -0
  29. package/src/executors/plan/executor.ts +4 -0
  30. package/src/generators/init/init.ts +15 -0
  31. package/tsconfig.json +31 -0
  32. package/tsup.config.ts +29 -0
  33. /package/{dist/src → src}/base/base-terraform-executor.schema.d.ts +0 -0
  34. /package/{dist/src → src}/base/base-terraform-executor.schema.json +0 -0
  35. /package/{docs/api → src}/base/base-terraform-executor.schema.md +0 -0
  36. /package/{dist/src → src}/executors/apply/schema.d.ts +0 -0
  37. /package/{dist/src → src}/executors/apply/schema.json +0 -0
  38. /package/{dist/src → src}/executors/destroy/schema.d.ts +0 -0
  39. /package/{dist/src → src}/executors/destroy/schema.json +0 -0
  40. /package/{dist/src → src}/executors/output/schema.d.ts +0 -0
  41. /package/{dist/src → src}/executors/output/schema.json +0 -0
  42. /package/{dist/src → src}/executors/plan/schema.d.ts +0 -0
  43. /package/{dist/src → src}/executors/plan/schema.json +0 -0
  44. /package/{dist/src → src}/generators/init/schema.d.ts +0 -0
  45. /package/{dist/src → src}/generators/init/schema.json +0 -0
package/.eslintrc.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "extends": ["../../.eslintrc.json"],
3
+ "ignorePatterns": ["!**/*"],
4
+ "overrides": [
5
+ {
6
+ "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7
+ "parserOptions": {
8
+ "project": ["packages/terraform-tools/tsconfig.*?.json"]
9
+ },
10
+ "rules": {}
11
+ },
12
+ {
13
+ "files": ["*.ts", "*.tsx"],
14
+ "rules": {}
15
+ },
16
+ {
17
+ "files": ["*.js", "*.jsx"],
18
+ "rules": {}
19
+ },
20
+ {
21
+ "files": ["*.json"],
22
+ "parser": "jsonc-eslint-parser",
23
+ "rules": {
24
+ "@nx/dependency-checks": "error"
25
+ }
26
+ },
27
+ {
28
+ "files": ["./package.json"],
29
+ "parser": "jsonc-eslint-parser",
30
+ "rules": {
31
+ "@nx/nx-plugin-checks": "error"
32
+ }
33
+ }
34
+ ]
35
+ }
package/CHANGELOG.md CHANGED
@@ -2,6 +2,39 @@
2
2
 
3
3
  # Changelog for Storm Ops - Terraform Tools
4
4
 
5
+ ## [0.57.1](https://github.com/storm-software/storm-ops/releases/tag/terraform-tools%400.57.1) (2025-05-06)
6
+
7
+ ### Bug Fixes
8
+
9
+ - **workspace-tools:** Resolve issue with missing dependencies
10
+ ([e4fcafde0](https://github.com/storm-software/storm-ops/commit/e4fcafde0))
11
+
12
+ ### Miscellaneous
13
+
14
+ - **monorepo:** Regenerate README markdown files
15
+ ([6eabb3ff1](https://github.com/storm-software/storm-ops/commit/6eabb3ff1))
16
+
17
+ ## [0.57.0](https://github.com/storm-software/storm-ops/releases/tag/terraform-tools%400.57.0) (2025-05-06)
18
+
19
+ ### Features
20
+
21
+ - **workspace-tools:** Update the publish executor source code
22
+ ([527dcfe84](https://github.com/storm-software/storm-ops/commit/527dcfe84))
23
+
24
+ ### Miscellaneous
25
+
26
+ - **monorepo:** Regenerate README markdown files
27
+ ([d58a4014e](https://github.com/storm-software/storm-ops/commit/d58a4014e))
28
+
29
+ ## [0.56.2](https://github.com/storm-software/storm-ops/releases/tag/terraform-tools%400.56.2) (2025-05-05)
30
+
31
+ ### Miscellaneous
32
+
33
+ - **workspace-tools:** Skip git checks during publish
34
+ ([7fdcbfc9a](https://github.com/storm-software/storm-ops/commit/7fdcbfc9a))
35
+ - **monorepo:** Regenerate README markdown files
36
+ ([fb8ab0609](https://github.com/storm-software/storm-ops/commit/fb8ab0609))
37
+
5
38
  ## [0.56.1](https://github.com/storm-software/storm-ops/releases/tag/terraform-tools%400.56.1) (2025-05-05)
6
39
 
7
40
  ### Miscellaneous
package/README.md CHANGED
@@ -21,7 +21,7 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
21
21
 
22
22
  <h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
23
23
 
24
- [![Version](https://img.shields.io/badge/version-0.56.0-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
24
+ [![Version](https://img.shields.io/badge/version-0.56.2-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
25
25
 
26
26
  <!-- prettier-ignore-start -->
27
27
  <!-- markdownlint-disable -->
@@ -1059,8 +1059,15 @@ var executor_default6 = withRunExecutor(
1059
1059
  );
1060
1060
 
1061
1061
  // ../workspace-tools/src/executors/npm-publish/executor.ts
1062
- import { execSync as execSync3 } from "node:child_process";
1063
- import { readFile as readFile5 } from "node:fs/promises";
1062
+ import {
1063
+ detectPackageManager,
1064
+ readJsonFile
1065
+ } from "@nx/devkit";
1066
+ import * as columnify from "columnify";
1067
+ import { exec, execSync as execSync3 } from "node:child_process";
1068
+ import { existsSync as existsSync6 } from "node:fs";
1069
+ import { relative as relative3 } from "node:path";
1070
+ import { env as appendLocalEnv } from "npm-run-path";
1064
1071
 
1065
1072
  // ../workspace-tools/src/utils/pnpm-deps-update.ts
1066
1073
  import { existsSync as existsSync5 } from "node:fs";
@@ -2428,8 +2435,8 @@ var DEFAULT_COMMIT_QUESTIONS = {
2428
2435
  };
2429
2436
 
2430
2437
  // ../workspace-tools/src/generators/release-version/generator.ts
2431
- import { exec, execSync as execSync4 } from "node:child_process";
2432
- import { relative as relative3 } from "node:path";
2438
+ import { exec as exec2, execSync as execSync4 } from "node:child_process";
2439
+ import { relative as relative4 } from "node:path";
2433
2440
  import { IMPLICIT_DEFAULT_RELEASE_GROUP } from "nx/src/command-line/release/config/config";
2434
2441
  import {
2435
2442
  getFirstGitCommit,
@@ -2820,10 +2827,10 @@ import { retrieveProjectConfigurationsWithoutPluginInference } from "nx/src/proj
2820
2827
  // ../workspace-tools/src/utils/lock-file.ts
2821
2828
  import {
2822
2829
  output as output2,
2823
- readJsonFile,
2830
+ readJsonFile as readJsonFile2,
2824
2831
  workspaceRoot as workspaceRoot2
2825
2832
  } from "@nx/devkit";
2826
- import { existsSync as existsSync6 } from "node:fs";
2833
+ import { existsSync as existsSync7 } from "node:fs";
2827
2834
  import { join as join2 } from "node:path";
2828
2835
  import {
2829
2836
  getNpmLockfileDependencies,
@@ -2847,14 +2854,14 @@ var PNPM_LOCK_PATH = join2(workspaceRoot2, PNPM_LOCK_FILE);
2847
2854
  // ../workspace-tools/src/utils/package-helpers.ts
2848
2855
  import {
2849
2856
  joinPathFragments as joinPathFragments6,
2850
- readJsonFile as readJsonFile2
2857
+ readJsonFile as readJsonFile3
2851
2858
  } from "@nx/devkit";
2852
- import { existsSync as existsSync7 } from "node:fs";
2859
+ import { existsSync as existsSync8 } from "node:fs";
2853
2860
 
2854
2861
  // ../workspace-tools/src/utils/plugin-helpers.ts
2855
- import { readJsonFile as readJsonFile3 } from "@nx/devkit";
2862
+ import { readJsonFile as readJsonFile4 } from "@nx/devkit";
2856
2863
  import defu3 from "defu";
2857
- import { existsSync as existsSync8 } from "node:fs";
2864
+ import { existsSync as existsSync9 } from "node:fs";
2858
2865
  import { dirname, join as join3 } from "node:path";
2859
2866
 
2860
2867
  // ../workspace-tools/src/utils/typia-transform.ts
@@ -1061,6 +1061,13 @@ var executor_default6 = _chunkA4RDGLKCjs.withRunExecutor.call(void 0,
1061
1061
 
1062
1062
 
1063
1063
 
1064
+
1065
+ var _columnify = require('columnify'); var columnify = _interopRequireWildcard(_columnify);
1066
+
1067
+
1068
+
1069
+ var _npmrunpath = require('npm-run-path');
1070
+
1064
1071
  // ../workspace-tools/src/utils/pnpm-deps-update.ts
1065
1072
 
1066
1073
 
package/dist/executors.js CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";require('./chunk-E7SPQEPH.js');
2
- require('./chunk-AJVSFBNT.js');
3
2
  require('./chunk-2WTDMDFS.js');
4
3
  require('./chunk-OV7TVEAC.js');
5
4
  require('./chunk-WJV4GOSN.js');
5
+ require('./chunk-AJVSFBNT.js');
6
6
  require('./chunk-ZLPOE4VZ.js');
7
7
  require('./chunk-A4RDGLKC.js');
8
8
  require('./chunk-3RG5ZIWI.js');
@@ -1,8 +1,8 @@
1
1
  import "./chunk-HYHKZPRR.mjs";
2
- import "./chunk-LHAZ3WPQ.mjs";
3
2
  import "./chunk-VNME2RIT.mjs";
4
3
  import "./chunk-5TXZ2IQ6.mjs";
5
4
  import "./chunk-ONGG25RY.mjs";
5
+ import "./chunk-LHAZ3WPQ.mjs";
6
6
  import "./chunk-7GH4VDRM.mjs";
7
7
  import "./chunk-DIXFQWYR.mjs";
8
8
  import "./chunk-IEZKYJSF.mjs";
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-N2YKXZ5R.js');
2
2
 
3
3
 
4
- var _chunkN5AGYIJOjs = require('./chunk-N5AGYIJO.js');
4
+ var _chunkQWYUK6DVjs = require('./chunk-QWYUK6DV.js');
5
5
  require('./chunk-A4RDGLKC.js');
6
6
  require('./chunk-3RG5ZIWI.js');
7
7
 
8
8
 
9
- exports.initGenerator = _chunkN5AGYIJOjs.initGenerator;
9
+ exports.initGenerator = _chunkQWYUK6DVjs.initGenerator;
@@ -1,7 +1,7 @@
1
1
  import "./chunk-23KFTIT2.mjs";
2
2
  import {
3
3
  initGenerator
4
- } from "./chunk-L3RPHNAE.mjs";
4
+ } from "./chunk-67CRAPR7.mjs";
5
5
  import "./chunk-DIXFQWYR.mjs";
6
6
  import "./chunk-IEZKYJSF.mjs";
7
7
  export {
package/dist/index.js CHANGED
@@ -1,23 +1,23 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-E7SPQEPH.js');
2
- require('./chunk-AJVSFBNT.js');
3
2
  require('./chunk-2WTDMDFS.js');
4
3
  require('./chunk-OV7TVEAC.js');
5
4
  require('./chunk-WJV4GOSN.js');
6
5
  require('./chunk-N2YKXZ5R.js');
6
+
7
+
8
+ var _chunkQWYUK6DVjs = require('./chunk-QWYUK6DV.js');
7
9
  require('./chunk-GUQOEBFW.js');
8
10
 
9
11
 
10
12
  var _chunkILC773N2js = require('./chunk-ILC773N2.js');
13
+ require('./chunk-AJVSFBNT.js');
11
14
 
12
15
 
13
16
  var _chunkZLPOE4VZjs = require('./chunk-ZLPOE4VZ.js');
14
-
15
-
16
- var _chunkN5AGYIJOjs = require('./chunk-N5AGYIJO.js');
17
17
  require('./chunk-A4RDGLKC.js');
18
18
  require('./chunk-3RG5ZIWI.js');
19
19
 
20
20
 
21
21
 
22
22
 
23
- exports.baseTerraformExecutorSchema = _chunkILC773N2js.base_terraform_executor_untyped_default; exports.initGenerator = _chunkN5AGYIJOjs.initGenerator; exports.withTerraformExecutor = _chunkZLPOE4VZjs.withTerraformExecutor;
23
+ exports.baseTerraformExecutorSchema = _chunkILC773N2js.base_terraform_executor_untyped_default; exports.initGenerator = _chunkQWYUK6DVjs.initGenerator; exports.withTerraformExecutor = _chunkZLPOE4VZjs.withTerraformExecutor;
package/dist/index.mjs CHANGED
@@ -1,19 +1,19 @@
1
1
  import "./chunk-HYHKZPRR.mjs";
2
- import "./chunk-LHAZ3WPQ.mjs";
3
2
  import "./chunk-VNME2RIT.mjs";
4
3
  import "./chunk-5TXZ2IQ6.mjs";
5
4
  import "./chunk-ONGG25RY.mjs";
6
5
  import "./chunk-23KFTIT2.mjs";
6
+ import {
7
+ initGenerator
8
+ } from "./chunk-67CRAPR7.mjs";
7
9
  import "./chunk-CA7S5MOH.mjs";
8
10
  import {
9
11
  base_terraform_executor_untyped_default
10
12
  } from "./chunk-EL25IDXP.mjs";
13
+ import "./chunk-LHAZ3WPQ.mjs";
11
14
  import {
12
15
  withTerraformExecutor
13
16
  } from "./chunk-7GH4VDRM.mjs";
14
- import {
15
- initGenerator
16
- } from "./chunk-L3RPHNAE.mjs";
17
17
  import "./chunk-DIXFQWYR.mjs";
18
18
  import "./chunk-IEZKYJSF.mjs";
19
19
  export {
@@ -1,10 +1,10 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunkN5AGYIJOjs = require('../../../chunk-N5AGYIJO.js');
4
+ var _chunkQWYUK6DVjs = require('../../../chunk-QWYUK6DV.js');
5
5
  require('../../../chunk-A4RDGLKC.js');
6
6
  require('../../../chunk-3RG5ZIWI.js');
7
7
 
8
8
 
9
9
 
10
- exports.default = _chunkN5AGYIJOjs.init_default; exports.initGenerator = _chunkN5AGYIJOjs.initGenerator;
10
+ exports.default = _chunkQWYUK6DVjs.init_default; exports.initGenerator = _chunkQWYUK6DVjs.initGenerator;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  initGenerator,
3
3
  init_default
4
- } from "../../../chunk-L3RPHNAE.mjs";
4
+ } from "../../../chunk-67CRAPR7.mjs";
5
5
  import "../../../chunk-DIXFQWYR.mjs";
6
6
  import "../../../chunk-IEZKYJSF.mjs";
7
7
  export {
package/executors.ts ADDED
@@ -0,0 +1,8 @@
1
+ export * from "./src/executors/apply/executor";
2
+ export { type ApplyExecutorSchema } from "./src/executors/apply/schema.d";
3
+ export * from "./src/executors/destroy/executor";
4
+ export { type DestroyExecutorSchema } from "./src/executors/destroy/schema.d";
5
+ export * from "./src/executors/output/executor";
6
+ export { type OutputExecutorSchema } from "./src/executors/output/schema.d";
7
+ export * from "./src/executors/plan/executor";
8
+ export { type PlanExecutorSchema } from "./src/executors/plan/schema.d";
package/generators.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./src/generators/init/init";
2
+ export { type InitGeneratorSchema } from "./src/generators/init/schema.d";
package/index.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from "./executors";
2
+ export * from "./generators";
3
+ export * from "./src/base";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/terraform-tools",
3
- "version": "0.56.1",
3
+ "version": "0.57.1",
4
4
  "description": "Tools for managing Terraform infrastructure within a Nx workspace.",
5
5
  "repository": {
6
6
  "type": "github",
package/project.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "terraform-tools",
3
+ "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
+ "sourceRoot": "packages/terraform-tools/src",
5
+ "projectType": "library",
6
+ "implicitDependencies": ["workspace-tools", "untyped"],
7
+ "targets": {
8
+ "build-untyped": {
9
+ "executor": "nx:run-commands",
10
+ "dependsOn": ["clean", "^build"],
11
+ "inputs": [
12
+ "{projectRoot}/src/**/untyped.ts",
13
+ "{projectRoot}/src/**/*.untyped.ts"
14
+ ],
15
+ "outputs": [
16
+ "{projectRoot}/src/**/schema.d.ts",
17
+ "{projectRoot}/src/**/*.schema.d.ts",
18
+ "{projectRoot}/src/**/schema.md",
19
+ "{projectRoot}/src/**/*.schema.md",
20
+ "{projectRoot}/src/**/schema.json",
21
+ "{projectRoot}/src/**/*.schema.json"
22
+ ],
23
+ "options": {
24
+ "commands": [
25
+ "node dist/packages/untyped/bin/untyped.cjs generate --entry=\"packages/terraform-tools/**/{untyped.ts,*.untyped.ts}\" "
26
+ ]
27
+ }
28
+ },
29
+ "build-base": {
30
+ "executor": "nx:run-commands",
31
+ "dependsOn": ["build-untyped", "clean", "^build"],
32
+ "options": {
33
+ "command": "tsup-node --config=tsup.config.ts",
34
+ "cwd": "{projectRoot}"
35
+ }
36
+ },
37
+ "build": {
38
+ "executor": "nx:run-commands",
39
+ "dependsOn": ["build-base", "build-untyped"],
40
+ "options": {
41
+ "commands": [
42
+ "pnpm copyfiles LICENSE dist/packages/terraform-tools",
43
+ "pnpm copyfiles --up=2 ./packages/terraform-tools/*.md ./packages/terraform-tools/executors.json ./packages/terraform-tools/generators.json ./packages/terraform-tools/package.json dist/packages/terraform-tools",
44
+ "pnpm copyfiles --up=3 \"./packages/terraform-tools/dist/**/*\" dist/packages/terraform-tools/dist",
45
+ "pnpm copyfiles --up=3 \"./packages/terraform-tools/src/**/*schema.d.ts\" dist/packages/terraform-tools/dist/src",
46
+ "pnpm copyfiles --up=3 \"./packages/terraform-tools/src/**/*schema.json\" dist/packages/terraform-tools/dist/src",
47
+ "pnpm copyfiles --up=3 \"./packages/terraform-tools/src/**/*.md\" dist/packages/terraform-tools/docs/api",
48
+ "pnpm copyfiles --up=4 \"./packages/terraform-tools/src/generators/*/files/**/*\" dist/packages/terraform-tools/dist/src/generators"
49
+ ]
50
+ }
51
+ },
52
+
53
+ "nx-release-publish": {
54
+ "executor": "@storm-software/workspace-tools:npm-publish"
55
+ }
56
+ }
57
+ }
@@ -0,0 +1,90 @@
1
+ // import baseExecutorSchema from "@storm-software/workspace-tools/base/base-executor.schema";
2
+ import { defineUntypedSchema } from "untyped";
3
+
4
+ export default defineUntypedSchema({
5
+ $schema: {
6
+ title: "Base Terraform Executor",
7
+ description: "A base type definition for a Terraform executor schema",
8
+ },
9
+ backendConfig: {
10
+ $schema: {
11
+ title: "Backend Config",
12
+ type: "array",
13
+ description: "The backend configuration",
14
+ },
15
+ $default: [],
16
+ },
17
+ autoApproval: {
18
+ $schema: {
19
+ title: "Auto Approval",
20
+ type: "boolean",
21
+ description: "Whether to auto-approve the plan",
22
+ },
23
+ $default: false,
24
+ },
25
+ planFile: {
26
+ $schema: {
27
+ title: "Plan File",
28
+ format: "path",
29
+ description: "The plan file",
30
+ type: "string",
31
+ },
32
+ $default: "plan.out",
33
+ },
34
+ formatWrite: {
35
+ $schema: {
36
+ title: "Format Write",
37
+ type: "boolean",
38
+ description: "Whether to format the files before writing",
39
+ },
40
+ $default: false,
41
+ },
42
+ upgrade: {
43
+ $schema: {
44
+ title: "Upgrade",
45
+ type: "boolean",
46
+ description: "Whether to upgrade the modules",
47
+ },
48
+ $default: false,
49
+ },
50
+ migrateState: {
51
+ $schema: {
52
+ title: "Migrate State",
53
+ type: "boolean",
54
+ description: "Whether to migrate the state",
55
+ },
56
+ $default: false,
57
+ },
58
+ lock: {
59
+ $schema: {
60
+ title: "Lock",
61
+ type: "boolean",
62
+ description: "Whether to lock the state",
63
+ },
64
+ $default: false,
65
+ },
66
+ varFile: {
67
+ $schema: {
68
+ title: "Var File",
69
+ format: "path",
70
+ type: "string",
71
+ description: "The variable file",
72
+ },
73
+ $default: "variables.tf",
74
+ },
75
+ varString: {
76
+ $schema: {
77
+ title: "Var String",
78
+ type: "string",
79
+ description: "The variable string",
80
+ },
81
+ },
82
+ reconfigure: {
83
+ $schema: {
84
+ title: "Reconfigure",
85
+ type: "boolean",
86
+ description: "Whether to reconfigure the state",
87
+ },
88
+ $default: false,
89
+ },
90
+ });
@@ -0,0 +1,2 @@
1
+ export { default as baseTerraformExecutorSchema } from "./base-terraform-executor.untyped";
2
+ export * from "./terraform-executor";
@@ -0,0 +1,101 @@
1
+ import type { ExecutorContext } from "@nx/devkit";
2
+ import { StormWorkspaceConfig } from "@storm-software/config";
3
+ import { ProjectTokenizerOptions, run } from "@storm-software/config-tools";
4
+ import { withRunExecutor } from "@storm-software/workspace-tools/base/base-executor";
5
+ import type { BaseExecutorSchema } from "@storm-software/workspace-tools/base/base-executor.schema.d";
6
+ import type { BaseExecutorOptions } from "@storm-software/workspace-tools/types";
7
+ import { which } from "shelljs";
8
+ import type { BaseTerraformExecutorSchema } from "./base-terraform-executor.schema.d";
9
+
10
+ export type TerraformExecutorSchema = BaseExecutorSchema &
11
+ Partial<BaseTerraformExecutorSchema>;
12
+
13
+ export type NormalizedTerraformExecutorOptions = ProjectTokenizerOptions &
14
+ TerraformExecutorSchema;
15
+
16
+ export const withTerraformExecutor =
17
+ <TExecutorSchema extends TerraformExecutorSchema = TerraformExecutorSchema>(
18
+ command: string,
19
+ executorOptions: BaseExecutorOptions<TExecutorSchema> = {}
20
+ ) =>
21
+ async (
22
+ _options: TExecutorSchema,
23
+ context: ExecutorContext
24
+ ): Promise<{ success: boolean }> => {
25
+ return withRunExecutor<TExecutorSchema>(
26
+ `Terraform \`${command}\` Command Executor`,
27
+ async (
28
+ options: NormalizedTerraformExecutorOptions,
29
+ context: ExecutorContext,
30
+ config: StormWorkspaceConfig
31
+ ) => {
32
+ if (!which("tofu") || !which("terraform")) {
33
+ throw new Error(
34
+ "Both OpenTofu and Terraform are not installed. Please install one of the two before running this executor."
35
+ );
36
+ }
37
+ if (!which("terragrunt")) {
38
+ throw new Error(
39
+ "Terragrunt is not installed. Please install them before running this executor."
40
+ );
41
+ }
42
+
43
+ const {
44
+ backendConfig = [],
45
+ planFile,
46
+ autoApproval,
47
+ formatWrite,
48
+ upgrade,
49
+ migrateState,
50
+ lock,
51
+ varFile,
52
+ varString,
53
+ reconfigure
54
+ } = options;
55
+
56
+ let jsonBackendConfig = backendConfig;
57
+ if (typeof jsonBackendConfig === "string") {
58
+ jsonBackendConfig = JSON.parse(jsonBackendConfig);
59
+ }
60
+
61
+ run(
62
+ config,
63
+ [
64
+ "terragrunt",
65
+ command,
66
+ ...jsonBackendConfig.map(
67
+ config => `-backend-config="${config.key}=${config.name}"`
68
+ ),
69
+ command === "plan" && planFile && `-out ${planFile}`,
70
+ command === "plan" && varFile && `--var-file ${varFile}`,
71
+ command === "plan" && varString && `--var ${varString}`,
72
+ command === "destroy" && autoApproval && "-auto-approve",
73
+ command === "apply" && autoApproval && "-auto-approve",
74
+ command === "apply" && planFile,
75
+ command === "apply" && varString && `--var ${varString}`,
76
+ command === "fmt" && "--recursive",
77
+ command === "fmt" && !formatWrite && "--check --list",
78
+ command === "init" && upgrade && "-upgrade",
79
+ command === "init" && migrateState && "-migrate-state",
80
+ command === "init" && reconfigure && "-reconfigure",
81
+ command === "providers" && lock && "lock",
82
+ command === "test" && varFile && `--var-file ${varFile}`,
83
+ command === "test" && varString && `--var ${varString}`
84
+ ]
85
+ .filter(Boolean)
86
+ .join(" "),
87
+ options.sourceRoot,
88
+ "inherit",
89
+ process.env.CI
90
+ ? {
91
+ TF_IN_AUTOMATION: "true",
92
+ TF_INPUT: "0"
93
+ }
94
+ : {}
95
+ );
96
+
97
+ return null;
98
+ },
99
+ executorOptions
100
+ )(_options, context);
101
+ };
@@ -0,0 +1,18 @@
1
+ import { ExecutorContext } from "@nx/devkit";
2
+
3
+ import executor from "./executor";
4
+ import { ApplyExecutorSchema } from "./schema";
5
+
6
+ const options: ApplyExecutorSchema = {};
7
+ const context: ExecutorContext = {
8
+ root: "",
9
+ cwd: process.cwd(),
10
+ isVerbose: false,
11
+ };
12
+
13
+ describe("Apply Executor", () => {
14
+ it("can run", async () => {
15
+ const output = await executor(options, context);
16
+ expect(output.success).toBe(true);
17
+ });
18
+ });
@@ -0,0 +1,4 @@
1
+ import { withTerraformExecutor } from "../../base/terraform-executor";
2
+ import { ApplyExecutorSchema } from "./schema.d";
3
+
4
+ export default withTerraformExecutor<ApplyExecutorSchema>("apply");
@@ -0,0 +1,18 @@
1
+ import { ExecutorContext } from "@nx/devkit";
2
+
3
+ import executor from "./executor";
4
+ import { DestroyExecutorSchema } from "./schema";
5
+
6
+ const options: DestroyExecutorSchema = {};
7
+ const context: ExecutorContext = {
8
+ root: "",
9
+ cwd: process.cwd(),
10
+ isVerbose: false,
11
+ };
12
+
13
+ describe("Destroy Executor", () => {
14
+ it("can run", async () => {
15
+ const output = await executor(options, context);
16
+ expect(output.success).toBe(true);
17
+ });
18
+ });
@@ -0,0 +1,4 @@
1
+ import { withTerraformExecutor } from "../../base/terraform-executor";
2
+ import { DestroyExecutorSchema } from "./schema.d";
3
+
4
+ export default withTerraformExecutor<DestroyExecutorSchema>("destroy");
@@ -0,0 +1,18 @@
1
+ import { ExecutorContext } from "@nx/devkit";
2
+
3
+ import executor from "./executor";
4
+ import { FmtExecutorSchema } from "./schema";
5
+
6
+ const options: FmtExecutorSchema = {};
7
+ const context: ExecutorContext = {
8
+ root: "",
9
+ cwd: process.cwd(),
10
+ isVerbose: false,
11
+ };
12
+
13
+ describe("Fmt Executor", () => {
14
+ it("can run", async () => {
15
+ const output = await executor(options, context);
16
+ expect(output.success).toBe(true);
17
+ });
18
+ });
@@ -0,0 +1,4 @@
1
+ import { withTerraformExecutor } from "../../base/terraform-executor";
2
+ import { OutputExecutorSchema } from "./schema.d";
3
+
4
+ export default withTerraformExecutor<OutputExecutorSchema>("output");
@@ -0,0 +1,18 @@
1
+ import { ExecutorContext } from "@nx/devkit";
2
+
3
+ import executor from "./executor";
4
+ import { PlanExecutorSchema } from "./schema";
5
+
6
+ const options: PlanExecutorSchema = {};
7
+ const context: ExecutorContext = {
8
+ root: "",
9
+ cwd: process.cwd(),
10
+ isVerbose: false,
11
+ };
12
+
13
+ describe("Plan Executor", () => {
14
+ it("can run", async () => {
15
+ const output = await executor(options, context);
16
+ expect(output.success).toBe(true);
17
+ });
18
+ });
@@ -0,0 +1,4 @@
1
+ import { withTerraformExecutor } from "../../base/terraform-executor";
2
+ import { PlanExecutorSchema } from "./schema.d";
3
+
4
+ export default withTerraformExecutor<PlanExecutorSchema>("plan");
@@ -0,0 +1,15 @@
1
+ import { formatFiles, type Tree } from "@nx/devkit";
2
+ import { initGenerator as baseInitGenerator } from "@storm-software/workspace-tools";
3
+ import type { InitGeneratorSchema } from "./schema";
4
+
5
+ export async function initGenerator(tree: Tree, schema: InitGeneratorSchema) {
6
+ const task = baseInitGenerator(tree, { skipFormat: !!schema.skipFormat });
7
+
8
+ if (!schema.skipFormat) {
9
+ await formatFiles(tree);
10
+ }
11
+
12
+ return task;
13
+ }
14
+
15
+ export default initGenerator;
package/tsconfig.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../dist/out-tsc",
5
+ "rootDir": "../..",
6
+ "target": "ESNext",
7
+ "module": "ESNext",
8
+ "lib": ["ESNext"],
9
+ "skipLibCheck": true,
10
+ "skipDefaultLibCheck": true,
11
+ "moduleResolution": "Bundler",
12
+ "moduleDetection": "force",
13
+ "types": ["node"]
14
+ },
15
+ "include": [
16
+ "executors.ts",
17
+ "generators.ts",
18
+ "index.ts",
19
+ "src/**/*.ts",
20
+ "src/**/*.d.ts",
21
+ "src/**/*.json",
22
+ "tsup.config.ts"
23
+ ],
24
+ "exclude": [
25
+ "jest.config.ts",
26
+ "src/generators/**/files/**/*",
27
+ "src/**/untyped.ts",
28
+ "src/**/*.spec.ts",
29
+ "src/**/*.test.ts"
30
+ ]
31
+ }
package/tsup.config.ts ADDED
@@ -0,0 +1,29 @@
1
+ import { defineConfig } from "tsup";
2
+
3
+ export default defineConfig([
4
+ {
5
+ name: "terraform-tools",
6
+ target: "node22",
7
+ entryPoints: [
8
+ "./*.ts",
9
+ "./src/base/index.ts",
10
+ "./src/base/terraform-executor.ts",
11
+ "./src/base/*.untyped.ts",
12
+ "./src/executors/*/executor.ts",
13
+ "./src/executors/*/untyped.ts",
14
+ "./src/generators/*/generator.ts",
15
+ "./src/generators/*/untyped.ts",
16
+ "./src/generators/init/init.ts",
17
+ ],
18
+ outDir: "dist",
19
+ format: ["cjs", "esm"],
20
+ platform: "node",
21
+ splitting: true,
22
+ clean: true,
23
+ dts: true,
24
+ sourcemap: false,
25
+ shims: true,
26
+ tsconfig: "./tsconfig.json",
27
+ external: ["@storm-software/workspace-tools"],
28
+ },
29
+ ]);
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes