@agilecustoms/envctl 1.4.1 → 1.5.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.
@@ -212,7 +212,7 @@ export class TerraformAdapter {
212
212
  tfVarName = '';
213
213
  }
214
214
  }
215
- console.log('Running: terraform plan -auto-approve', ...args, '\n');
215
+ console.log('Running: terraform plan', ...args, '\n');
216
216
  try {
217
217
  await this.cli.run('terraform', ['plan', ...args], out_scanner, in_scanner);
218
218
  }
@@ -234,7 +234,7 @@ export class TerraformAdapter {
234
234
  }
235
235
  }
236
236
  async apply(args, attemptNo = 1) {
237
- console.log('Running: terraform apply ', ...args, '\n');
237
+ console.log('Running: terraform apply', ...args, '\n');
238
238
  this.printTime();
239
239
  try {
240
240
  await this.cli.run('terraform', ['apply', ...args]);
@@ -70,6 +70,7 @@ export class EnvService extends BaseService {
70
70
  throw new KnownException(`Env ${env.key} status is DELETING, please wait`);
71
71
  }
72
72
  }
73
+ await this.lockTerraform(env, env === null);
73
74
  await this.terraformAdapter.plan(env, tfArgs);
74
75
  }
75
76
  async createEphemeral(key) {
@@ -79,11 +80,13 @@ export class EnvService extends BaseService {
79
80
  async lockTerraform(env, newEnv = false) {
80
81
  console.log('Lock providers');
81
82
  const res = await this.terraformAdapter.lock(newEnv);
82
- if (res.lockFile) {
83
- env.lockFile = res.lockFile;
84
- }
85
- if (res.stateFile) {
86
- env.stateFile = res.stateFile;
83
+ if (env !== null) {
84
+ if (res.lockFile) {
85
+ env.lockFile = res.lockFile;
86
+ }
87
+ if (res.stateFile) {
88
+ env.stateFile = res.stateFile;
89
+ }
87
90
  }
88
91
  }
89
92
  async ensurePlan(env, args) {
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.1",
4
+ "version": "1.5.0",
5
5
  "author": "Alex Chekulaev",
6
6
  "type": "module",
7
7
  "engines": {
@@ -32,11 +32,10 @@
32
32
  "run-configure": "npm run run -- configure",
33
33
  "~": "",
34
34
  "run-core-init": " cd ../tt-core && terraform init -upgrade -backend-config=key=laxa1986 -reconfigure",
35
- "run-core-tfplan": "cd ../tt-core && terraform plan -out=.terraform/plan",
36
35
  "run-core-status": " npm run run -- status --cwd ../tt-core",
37
- "run-core-plan": " npm run run -- plan --cwd ../tt-core",
36
+ "run-core-plan": " npm run run -- plan --cwd ../tt-core -out=.terraform/plan",
37
+ "run-core-deployp": "npm run run -- deploy --cwd ../tt-core .terraform/plan",
38
38
  "run-core-deploy": " npm run run -- deploy --cwd ../tt-core -var=\"env_size=min\"",
39
- "run-core-deployp": "npm run run -- deploy .terraform/plan --cwd ../tt-core",
40
39
  "run-core-delete": " npm run run -- delete --cwd ../tt-core",
41
40
  "run-core-destroy": "npm run run -- destroy --cwd ../tt-core",
42
41
  "run-core-logs": " npm run run -- logs --cwd ../tt-core",