@storm-software/terraform-tools 0.56.0 → 0.57.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/.eslintrc.json +35 -0
- package/CHANGELOG.md +28 -0
- package/README.md +2 -1
- package/dist/{chunk-N5AGYIJO.js → chunk-5O5FAMA6.js} +8 -0
- package/dist/{chunk-L3RPHNAE.mjs → chunk-BS4MTLF3.mjs} +22 -14
- package/dist/generators.js +2 -2
- package/dist/generators.mjs +1 -1
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/dist/src/generators/init/init.js +2 -2
- package/dist/src/generators/init/init.mjs +1 -1
- package/executors.ts +8 -0
- package/generators.ts +2 -0
- package/index.ts +3 -0
- package/package.json +1 -1
- package/project.json +57 -0
- package/src/base/base-terraform-executor.untyped.ts +90 -0
- package/src/base/index.ts +2 -0
- package/src/base/terraform-executor.ts +101 -0
- package/src/executors/apply/executor.spec.ts +18 -0
- package/src/executors/apply/executor.ts +4 -0
- package/src/executors/destroy/executor.spec.ts +18 -0
- package/src/executors/destroy/executor.ts +4 -0
- package/src/executors/output/executor.spec.ts +18 -0
- package/src/executors/output/executor.ts +4 -0
- package/src/executors/plan/executor.spec.ts +18 -0
- package/src/executors/plan/executor.ts +4 -0
- package/src/generators/init/init.ts +15 -0
- package/tsconfig.json +31 -0
- package/tsup.config.ts +29 -0
- /package/{dist/src → src}/base/base-terraform-executor.schema.d.ts +0 -0
- /package/{dist/src → src}/base/base-terraform-executor.schema.json +0 -0
- /package/{docs/api → src}/base/base-terraform-executor.schema.md +0 -0
- /package/{dist/src → src}/executors/apply/schema.d.ts +0 -0
- /package/{dist/src → src}/executors/apply/schema.json +0 -0
- /package/{dist/src → src}/executors/destroy/schema.d.ts +0 -0
- /package/{dist/src → src}/executors/destroy/schema.json +0 -0
- /package/{dist/src → src}/executors/output/schema.d.ts +0 -0
- /package/{dist/src → src}/executors/output/schema.json +0 -0
- /package/{dist/src → src}/executors/plan/schema.d.ts +0 -0
- /package/{dist/src → src}/executors/plan/schema.json +0 -0
- /package/{dist/src → src}/generators/init/schema.d.ts +0 -0
- /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,34 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog for Storm Ops - Terraform Tools
|
|
4
4
|
|
|
5
|
+
## [0.57.0](https://github.com/storm-software/storm-ops/releases/tag/terraform-tools%400.57.0) (2025-05-06)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
- **workspace-tools:** Update the publish executor source code
|
|
10
|
+
([527dcfe84](https://github.com/storm-software/storm-ops/commit/527dcfe84))
|
|
11
|
+
|
|
12
|
+
### Miscellaneous
|
|
13
|
+
|
|
14
|
+
- **monorepo:** Regenerate README markdown files
|
|
15
|
+
([d58a4014e](https://github.com/storm-software/storm-ops/commit/d58a4014e))
|
|
16
|
+
|
|
17
|
+
## [0.56.2](https://github.com/storm-software/storm-ops/releases/tag/terraform-tools%400.56.2) (2025-05-05)
|
|
18
|
+
|
|
19
|
+
### Miscellaneous
|
|
20
|
+
|
|
21
|
+
- **workspace-tools:** Skip git checks during publish
|
|
22
|
+
([7fdcbfc9a](https://github.com/storm-software/storm-ops/commit/7fdcbfc9a))
|
|
23
|
+
- **monorepo:** Regenerate README markdown files
|
|
24
|
+
([fb8ab0609](https://github.com/storm-software/storm-ops/commit/fb8ab0609))
|
|
25
|
+
|
|
26
|
+
## [0.56.1](https://github.com/storm-software/storm-ops/releases/tag/terraform-tools%400.56.1) (2025-05-05)
|
|
27
|
+
|
|
28
|
+
### Miscellaneous
|
|
29
|
+
|
|
30
|
+
- **monorepo:** Regenerate README markdown files
|
|
31
|
+
([372776939](https://github.com/storm-software/storm-ops/commit/372776939))
|
|
32
|
+
|
|
5
33
|
## [0.56.0](https://github.com/storm-software/storm-ops/releases/tag/terraform-tools%400.56.0) (2025-05-05)
|
|
6
34
|
|
|
7
35
|
### Features
|
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
|
-
[](https://prettier.io/) [](http://nx.dev/) [](https://nextjs.org/) [](http://commitizen.github.io/cz-cli/)  [](https://fumadocs.vercel.app/) 
|
|
25
25
|
|
|
26
26
|
<!-- prettier-ignore-start -->
|
|
27
27
|
<!-- markdownlint-disable -->
|
|
@@ -40,6 +40,7 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
|
|
|
40
40
|
|
|
41
41
|
<!-- START doctoc -->
|
|
42
42
|
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
|
43
|
+
|
|
43
44
|
## Table of Contents
|
|
44
45
|
|
|
45
46
|
- [Storm Terraform Tools](#storm-terraform-tools)
|
|
@@ -1061,6 +1061,14 @@ var executor_default6 = _chunkA4RDGLKCjs.withRunExecutor.call(void 0,
|
|
|
1061
1061
|
|
|
1062
1062
|
|
|
1063
1063
|
|
|
1064
|
+
|
|
1065
|
+
|
|
1066
|
+
var _columnify = require('columnify'); var columnify = _interopRequireWildcard(_columnify);
|
|
1067
|
+
|
|
1068
|
+
|
|
1069
|
+
var _npmrunpath = require('npm-run-path');
|
|
1070
|
+
|
|
1071
|
+
|
|
1064
1072
|
// ../workspace-tools/src/utils/pnpm-deps-update.ts
|
|
1065
1073
|
|
|
1066
1074
|
|
|
@@ -1059,8 +1059,16 @@ var executor_default6 = withRunExecutor(
|
|
|
1059
1059
|
);
|
|
1060
1060
|
|
|
1061
1061
|
// ../workspace-tools/src/executors/npm-publish/executor.ts
|
|
1062
|
+
import {
|
|
1063
|
+
detectPackageManager,
|
|
1064
|
+
readJsonFile
|
|
1065
|
+
} from "@nx/devkit";
|
|
1066
|
+
import { exec } from "child_process";
|
|
1067
|
+
import * as columnify from "columnify";
|
|
1068
|
+
import { existsSync as existsSync6 } from "fs";
|
|
1062
1069
|
import { execSync as execSync3 } from "node:child_process";
|
|
1063
|
-
import {
|
|
1070
|
+
import { env as appendLocalEnv } from "npm-run-path";
|
|
1071
|
+
import { join, relative as relative3 } from "path";
|
|
1064
1072
|
|
|
1065
1073
|
// ../workspace-tools/src/utils/pnpm-deps-update.ts
|
|
1066
1074
|
import { existsSync as existsSync5 } from "node:fs";
|
|
@@ -2428,8 +2436,8 @@ var DEFAULT_COMMIT_QUESTIONS = {
|
|
|
2428
2436
|
};
|
|
2429
2437
|
|
|
2430
2438
|
// ../workspace-tools/src/generators/release-version/generator.ts
|
|
2431
|
-
import { exec, execSync as execSync4 } from "node:child_process";
|
|
2432
|
-
import { relative as
|
|
2439
|
+
import { exec as exec2, execSync as execSync4 } from "node:child_process";
|
|
2440
|
+
import { relative as relative4 } from "node:path";
|
|
2433
2441
|
import { IMPLICIT_DEFAULT_RELEASE_GROUP } from "nx/src/command-line/release/config/config";
|
|
2434
2442
|
import {
|
|
2435
2443
|
getFirstGitCommit,
|
|
@@ -2820,11 +2828,11 @@ import { retrieveProjectConfigurationsWithoutPluginInference } from "nx/src/proj
|
|
|
2820
2828
|
// ../workspace-tools/src/utils/lock-file.ts
|
|
2821
2829
|
import {
|
|
2822
2830
|
output as output2,
|
|
2823
|
-
readJsonFile,
|
|
2831
|
+
readJsonFile as readJsonFile2,
|
|
2824
2832
|
workspaceRoot as workspaceRoot2
|
|
2825
2833
|
} from "@nx/devkit";
|
|
2826
|
-
import { existsSync as
|
|
2827
|
-
import { join as
|
|
2834
|
+
import { existsSync as existsSync7 } from "node:fs";
|
|
2835
|
+
import { join as join3 } from "node:path";
|
|
2828
2836
|
import {
|
|
2829
2837
|
getNpmLockfileDependencies,
|
|
2830
2838
|
getNpmLockfileNodes
|
|
@@ -2840,22 +2848,22 @@ import {
|
|
|
2840
2848
|
var YARN_LOCK_FILE = "yarn.lock";
|
|
2841
2849
|
var NPM_LOCK_FILE = "package-lock.json";
|
|
2842
2850
|
var PNPM_LOCK_FILE = "pnpm-lock.yaml";
|
|
2843
|
-
var YARN_LOCK_PATH =
|
|
2844
|
-
var NPM_LOCK_PATH =
|
|
2845
|
-
var PNPM_LOCK_PATH =
|
|
2851
|
+
var YARN_LOCK_PATH = join3(workspaceRoot2, YARN_LOCK_FILE);
|
|
2852
|
+
var NPM_LOCK_PATH = join3(workspaceRoot2, NPM_LOCK_FILE);
|
|
2853
|
+
var PNPM_LOCK_PATH = join3(workspaceRoot2, PNPM_LOCK_FILE);
|
|
2846
2854
|
|
|
2847
2855
|
// ../workspace-tools/src/utils/package-helpers.ts
|
|
2848
2856
|
import {
|
|
2849
2857
|
joinPathFragments as joinPathFragments6,
|
|
2850
|
-
readJsonFile as
|
|
2858
|
+
readJsonFile as readJsonFile3
|
|
2851
2859
|
} from "@nx/devkit";
|
|
2852
|
-
import { existsSync as
|
|
2860
|
+
import { existsSync as existsSync8 } from "node:fs";
|
|
2853
2861
|
|
|
2854
2862
|
// ../workspace-tools/src/utils/plugin-helpers.ts
|
|
2855
|
-
import { readJsonFile as
|
|
2863
|
+
import { readJsonFile as readJsonFile4 } from "@nx/devkit";
|
|
2856
2864
|
import defu3 from "defu";
|
|
2857
|
-
import { existsSync as
|
|
2858
|
-
import { dirname, join as
|
|
2865
|
+
import { existsSync as existsSync9 } from "node:fs";
|
|
2866
|
+
import { dirname, join as join4 } from "node:path";
|
|
2859
2867
|
|
|
2860
2868
|
// ../workspace-tools/src/utils/typia-transform.ts
|
|
2861
2869
|
import transform2 from "typia/lib/transform";
|
package/dist/generators.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-N2YKXZ5R.js');
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunk5O5FAMA6js = require('./chunk-5O5FAMA6.js');
|
|
5
5
|
require('./chunk-A4RDGLKC.js');
|
|
6
6
|
require('./chunk-3RG5ZIWI.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
exports.initGenerator =
|
|
9
|
+
exports.initGenerator = _chunk5O5FAMA6js.initGenerator;
|
package/dist/generators.mjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ require('./chunk-WJV4GOSN.js');
|
|
|
5
5
|
require('./chunk-N2YKXZ5R.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunk5O5FAMA6js = require('./chunk-5O5FAMA6.js');
|
|
9
9
|
require('./chunk-GUQOEBFW.js');
|
|
10
10
|
|
|
11
11
|
|
|
@@ -20,4 +20,4 @@ require('./chunk-3RG5ZIWI.js');
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
exports.baseTerraformExecutorSchema = _chunkILC773N2js.base_terraform_executor_untyped_default; exports.initGenerator =
|
|
23
|
+
exports.baseTerraformExecutorSchema = _chunkILC773N2js.base_terraform_executor_untyped_default; exports.initGenerator = _chunk5O5FAMA6js.initGenerator; exports.withTerraformExecutor = _chunkZLPOE4VZjs.withTerraformExecutor;
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunk5O5FAMA6js = require('../../../chunk-5O5FAMA6.js');
|
|
5
5
|
require('../../../chunk-A4RDGLKC.js');
|
|
6
6
|
require('../../../chunk-3RG5ZIWI.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
exports.default =
|
|
10
|
+
exports.default = _chunk5O5FAMA6js.init_default; exports.initGenerator = _chunk5O5FAMA6js.initGenerator;
|
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
package/index.ts
ADDED
package/package.json
CHANGED
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,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,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,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,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,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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|