@payfit/iac 1.1.6 → 1.1.7-ephemeral-release-rerun.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
CHANGED
|
@@ -8,44 +8,6 @@ Nx plugin for infrastructure as code operations.
|
|
|
8
8
|
npx nx add @payfit/iac
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
## Features
|
|
12
|
-
|
|
13
|
-
### OpenTofu/Terraform Module Management
|
|
14
|
-
|
|
15
|
-
The plugin provides automatic formatting and linting for OpenTofu/Terraform modules:
|
|
16
|
-
|
|
17
|
-
- Running `tofu fmt` to format code
|
|
18
|
-
- Running `tflint` for linting
|
|
19
|
-
- Running `tofu validate` for validation
|
|
20
|
-
- Automatic version management for modules
|
|
21
|
-
|
|
22
|
-
#### OpenTofu/Terraform Detection
|
|
23
|
-
|
|
24
|
-
The plugin automatically detects OpenTofu/Terraform modules by looking for both:
|
|
25
|
-
|
|
26
|
-
- A `.spacelift/config.yml` file
|
|
27
|
-
- A `main.tf` file in your project root
|
|
28
|
-
|
|
29
|
-
When these files are present, the plugin will automatically configure the following targets:
|
|
30
|
-
|
|
31
|
-
- `tofu-format`: Format OpenTofu code (with `check` and `write` configurations)
|
|
32
|
-
- `lint`: Lint and validate OpenTofu code using tflint and tofu validate
|
|
33
|
-
- `nx-release-publish`: Configured as noop (Spacelift handles deployment from Git tags)
|
|
34
|
-
- `build`: Configured as noop (Spacelift handles building artifacts)
|
|
35
|
-
|
|
36
|
-
#### Usage
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
# Format terraform code (check mode)
|
|
40
|
-
nx run <terraform-project>:tofu-format
|
|
41
|
-
|
|
42
|
-
# Format terraform code (write mode)
|
|
43
|
-
nx run <terraform-project>:tofu-format:write
|
|
44
|
-
|
|
45
|
-
# Lint terraform code
|
|
46
|
-
nx run <terraform-project>:lint
|
|
47
|
-
```
|
|
48
|
-
|
|
49
11
|
## Executors
|
|
50
12
|
|
|
51
13
|
### Stack Migration
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -4,7 +4,6 @@ exports.createNodesV2 = void 0;
|
|
|
4
4
|
exports.createNodesInternal = createNodesInternal;
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
7
|
-
const terraform_detection_1 = require("./utils/terraform-detection");
|
|
8
7
|
exports.createNodesV2 = [
|
|
9
8
|
'**/project.json',
|
|
10
9
|
async (configFiles, options, context) => {
|
|
@@ -15,83 +14,7 @@ async function createNodesInternal(configFilePath, _options, _context) {
|
|
|
15
14
|
const projectConfiguration = (0, devkit_1.readJsonFile)(configFilePath);
|
|
16
15
|
const projectRoot = (0, path_1.dirname)(configFilePath);
|
|
17
16
|
const targets = {};
|
|
18
|
-
let release = null;
|
|
19
17
|
const isRootProject = projectRoot === '.';
|
|
20
|
-
const isTfModule = (0, terraform_detection_1.isTerraformModule)(projectRoot, projectConfiguration);
|
|
21
|
-
// Get tflintConfigFile from metadata or use default
|
|
22
|
-
const tflintConfigFile = (0, path_1.join)((0, devkit_1.offsetFromRoot)(projectRoot), '.tflint.hcl');
|
|
23
|
-
// Infer terraform module tasks
|
|
24
|
-
if (isTfModule) {
|
|
25
|
-
targets['build'] = {
|
|
26
|
-
executor: 'nx:run-commands',
|
|
27
|
-
outputs: ['{workspaceRoot}/dist/{projectRoot}'],
|
|
28
|
-
options: {
|
|
29
|
-
command: "mkdir -p dist/{projectRoot} && cp -r {projectRoot}/* dist/{projectRoot} && echo 'Build completed for {projectRoot}'",
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
targets['tofu-format'] = {
|
|
33
|
-
executor: 'nx:run-commands',
|
|
34
|
-
cache: false,
|
|
35
|
-
inputs: ['production', '^production'],
|
|
36
|
-
outputs: [],
|
|
37
|
-
options: {
|
|
38
|
-
cwd: '{projectRoot}',
|
|
39
|
-
command: 'tofu fmt -recursive',
|
|
40
|
-
},
|
|
41
|
-
configurations: {
|
|
42
|
-
check: {
|
|
43
|
-
args: '-check',
|
|
44
|
-
},
|
|
45
|
-
write: {
|
|
46
|
-
args: '-write',
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
defaultConfiguration: 'check',
|
|
50
|
-
metadata: {
|
|
51
|
-
technologies: ['tofu'],
|
|
52
|
-
description: 'Format OpenTofu code',
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
targets['lint'] = {
|
|
56
|
-
executor: 'nx:run-commands',
|
|
57
|
-
cache: false,
|
|
58
|
-
inputs: ['production', '^production'],
|
|
59
|
-
outputs: [],
|
|
60
|
-
options: {
|
|
61
|
-
cwd: '{projectRoot}',
|
|
62
|
-
commands: [
|
|
63
|
-
'tofu init -backend=false',
|
|
64
|
-
'tflint --init',
|
|
65
|
-
'tflint',
|
|
66
|
-
'tofu validate',
|
|
67
|
-
],
|
|
68
|
-
parallel: false,
|
|
69
|
-
},
|
|
70
|
-
env: {
|
|
71
|
-
TFLINT_CONFIG_FILE: tflintConfigFile,
|
|
72
|
-
},
|
|
73
|
-
metadata: {
|
|
74
|
-
technologies: ['tofu'],
|
|
75
|
-
description: 'Lint OpenTofu code',
|
|
76
|
-
},
|
|
77
|
-
};
|
|
78
|
-
targets['nx-release-publish'] = {
|
|
79
|
-
executor: 'nx:noop',
|
|
80
|
-
cache: false,
|
|
81
|
-
metadata: {
|
|
82
|
-
technologies: ['tofu'],
|
|
83
|
-
description: 'No release publish, Spacelift handles it from the Git tag',
|
|
84
|
-
},
|
|
85
|
-
};
|
|
86
|
-
if (!projectConfiguration?.release?.version
|
|
87
|
-
?.versionActions) {
|
|
88
|
-
release = {
|
|
89
|
-
version: {
|
|
90
|
-
versionActions: '@nx/js/src/release/version-actions',
|
|
91
|
-
},
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
18
|
// Only infer stack-migration target for root project
|
|
96
19
|
if (isRootProject) {
|
|
97
20
|
const stackMigrationConfig = (0, devkit_1.readJsonFile)((0, path_1.join)(__dirname, '/executors/stack-migration/schema.json'));
|
|
@@ -134,7 +57,6 @@ async function createNodesInternal(configFilePath, _options, _context) {
|
|
|
134
57
|
projects: {
|
|
135
58
|
[projectRoot]: {
|
|
136
59
|
targets,
|
|
137
|
-
release,
|
|
138
60
|
},
|
|
139
61
|
},
|
|
140
62
|
};
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAuBA,kDA+DC;AAtFD,+BAAoC;AAEpC,uCAMmB;AAEN,QAAA,aAAa,GAAkB;IAC1C,iBAAiB;IACjB,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;QACtC,OAAO,MAAM,IAAA,6BAAoB,EAC/B,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,CAC/B,mBAAmB,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,EACnD,WAAW,EACX,OAAO,EACP,OAAO,CACR,CAAA;IACH,CAAC;CACF,CAAA;AAEM,KAAK,UAAU,mBAAmB,CACvC,cAAsB,EACtB,QAAiB,EACjB,QAA8B;IAE9B,MAAM,oBAAoB,GACxB,IAAA,qBAAY,EAAC,cAAc,CAAC,CAAA;IAC9B,MAAM,WAAW,GAAG,IAAA,cAAO,EAAC,cAAc,CAAC,CAAA;IAE3C,MAAM,OAAO,GAAG,EAAE,CAAA;IAElB,MAAM,aAAa,GAAG,WAAW,KAAK,GAAG,CAAA;IAEzC,qDAAqD;IACrD,IAAI,aAAa,EAAE,CAAC;QAClB,MAAM,oBAAoB,GAAG,IAAA,qBAAY,EACvC,IAAA,WAAI,EAAC,SAAS,EAAE,wCAAwC,CAAC,CAC1D,CAAA;QAED,OAAO,CAAC,iBAAiB,CAAC,GAAG;YAC3B,QAAQ,EAAE,6BAA6B;YACvC,KAAK,EAAE,KAAK;YACZ,OAAO,EAAE;gBACP,OAAO,EAAE,KAAK;aACf;YACD,cAAc,EAAE;gBACd,IAAI,EAAE;oBACJ,OAAO,EAAE,MAAM;iBAChB;gBACD,KAAK,EAAE;oBACL,OAAO,EAAE,OAAO;iBACjB;gBACD,MAAM,EAAE;oBACN,OAAO,EAAE,QAAQ;iBAClB;gBACD,uBAAuB,EAAE;oBACvB,OAAO,EAAE,uBAAuB;iBACjC;gBACD,oBAAoB,EAAE;oBACpB,OAAO,EAAE,oBAAoB;iBAC9B;gBACD,oBAAoB,EAAE;oBACpB,OAAO,EAAE,oBAAoB;iBAC9B;gBACD,OAAO,EAAE;oBACP,OAAO,EAAE,SAAS;iBACnB;aACF;YACD,QAAQ,EAAE;gBACR,YAAY,EAAE,CAAC,WAAW,EAAE,WAAW,CAAC;gBACxC,WAAW,EACT,oBAAoB,EAAE,WAAW,IAAI,6BAA6B;aACrE;SACF,CAAA;IACH,CAAC;IAED,OAAO;QACL,QAAQ,EAAE;YACR,CAAC,WAAW,CAAC,EAAE;gBACb,OAAO;aACR;SACF;KACF,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payfit/iac",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.7-ephemeral-release-rerun.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "restricted"
|
|
6
6
|
},
|
|
@@ -18,8 +18,6 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"consola": "^3.4.2",
|
|
20
20
|
"js-yaml": "^4.1.0",
|
|
21
|
-
"memfs": "4.52.0",
|
|
22
|
-
"nx": "22.3.3",
|
|
23
21
|
"tslib": "^2.3.0",
|
|
24
22
|
"vitest": "4.0.17"
|
|
25
23
|
},
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isTerraformModule = isTerraformModule;
|
|
4
|
-
const node_fs_1 = require("node:fs");
|
|
5
|
-
const path_1 = require("path");
|
|
6
|
-
function isTerraformModule(projectRoot, _projectConfiguration) {
|
|
7
|
-
return ((0, node_fs_1.existsSync)((0, path_1.join)(projectRoot, '.spacelift', 'config.yml')) &&
|
|
8
|
-
(0, node_fs_1.existsSync)((0, path_1.join)(projectRoot, 'main.tf')));
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=terraform-detection.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"terraform-detection.js","sourceRoot":"","sources":["../../src/utils/terraform-detection.ts"],"names":[],"mappings":";;AAKA,8CAQC;AAbD,qCAAoC;AACpC,+BAA2B;AAI3B,SAAgB,iBAAiB,CAC/B,WAAmB,EACnB,qBAA2C;IAE3C,OAAO,CACL,IAAA,oBAAU,EAAC,IAAA,WAAI,EAAC,WAAW,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;QACzD,IAAA,oBAAU,EAAC,IAAA,WAAI,EAAC,WAAW,EAAE,SAAS,CAAC,CAAC,CACzC,CAAA;AACH,CAAC"}
|