@agilecustoms/envctl 1.4.0 → 1.4.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.
@@ -3,6 +3,7 @@ import { EnvApiClient, TerraformAdapter } from '../client/index.js';
3
3
  import { KnownException } from '../exceptions.js';
4
4
  import { EnvStatus } from '../model/index.js';
5
5
  import { BaseService } from './BaseService.js';
6
+ export const PLAN_FILE = '.terraform/envctl.plan';
6
7
  export class EnvService extends BaseService {
7
8
  cli;
8
9
  envApi;
@@ -89,9 +90,21 @@ export class EnvService extends BaseService {
89
90
  if (args.length > 0 && !args[0].startsWith('-')) {
90
91
  return args;
91
92
  }
92
- const planFile = '.terraform/envctl.plan';
93
- await this.terraformAdapter.plan(env, [`-out=${planFile}`, ...args]);
94
- return [planFile, ...args].filter(arg => !arg.startsWith('-var'));
93
+ await this.terraformAdapter.plan(env, [`-out=${PLAN_FILE}`, ...args]);
94
+ const PLAN_ARGS = ['-var', '-target', '-replace', '-refresh'];
95
+ const applyArgs = [PLAN_FILE];
96
+ for (let i = 0; i < args.length; i++) {
97
+ const arg = args[i];
98
+ if (arg === '-var' || arg === '-var-file') {
99
+ i++;
100
+ continue;
101
+ }
102
+ if (PLAN_ARGS.some(planArg => arg.startsWith(planArg))) {
103
+ continue;
104
+ }
105
+ applyArgs.push(arg);
106
+ }
107
+ return applyArgs;
95
108
  }
96
109
  async deploy(tfArgs) {
97
110
  const key = this.terraformAdapter.getTerraformBackend().getKey();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agilecustoms/envctl",
3
3
  "description": "node.js CLI client for manage environments",
4
- "version": "1.4.0",
4
+ "version": "1.4.1",
5
5
  "author": "Alex Chekulaev",
6
6
  "type": "module",
7
7
  "engines": {