@agilecustoms/envctl 1.10.5 → 1.11.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.
package/dist/container.js CHANGED
@@ -13,7 +13,8 @@ export function buildContainer(appVersion) {
13
13
  const httpClient = new HttpClient(appVersion, commandId);
14
14
  const envApiClient = new EnvApiClient(httpClient);
15
15
  const localStateService = new LocalStateService();
16
- const terraformAdapter = new TerraformAdapter(Date.now, cli, localStateService, backends);
16
+ const nonInteractive = !process.stdout.isTTY || process.env.CI === 'true';
17
+ const terraformAdapter = new TerraformAdapter(Date.now, cli, localStateService, backends, nonInteractive);
17
18
  const envService = new EnvService(cli, envApiClient, terraformAdapter);
18
19
  const logService = new LogService(cli, envApiClient, terraformAdapter);
19
20
  return { configService, envService, logService };
@@ -63,7 +63,7 @@ export class EnvService extends BaseService {
63
63
  }
64
64
  const newEnv = env === null;
65
65
  await this.lockTerraform(env, newEnv);
66
- await this.terraformAdapter.plan(env ?? { key }, tfArgs);
66
+ await this.terraformAdapter.plan(env ?? { key, ephemeral: false }, tfArgs);
67
67
  }
68
68
  async createEphemeral(key) {
69
69
  const createEnv = { key };
@@ -19,12 +19,14 @@ export class TerraformAdapter {
19
19
  now;
20
20
  cli;
21
21
  localStateService;
22
+ nonInteractive;
22
23
  backends;
23
24
  backend = undefined;
24
- constructor(now, cli, localStateService, backends) {
25
+ constructor(now, cli, localStateService, backends, nonInteractive) {
25
26
  this.now = now;
26
27
  this.cli = cli;
27
28
  this.localStateService = localStateService;
29
+ this.nonInteractive = nonInteractive;
28
30
  this.backends = backends.reduce((acc, backend) => {
29
31
  acc.set(backend.getType(), backend);
30
32
  return acc;
@@ -118,7 +120,7 @@ export class TerraformAdapter {
118
120
  tfArgs(env, args, vars = []) {
119
121
  const varDefs = this.getVarDefs();
120
122
  const argVars = this.getArgVars(args);
121
- const specialFields = { ...env, env: env.key };
123
+ const specialFields = { env: env.key, ephemeral: env.ephemeral };
122
124
  const extraArgs = [];
123
125
  for (const name of ['env', 'ephemeral']) {
124
126
  if (varDefs[name] && !argVars[name]) {
@@ -130,6 +132,9 @@ export class TerraformAdapter {
130
132
  extraArgs.push('-var=' + key + '=' + value);
131
133
  }
132
134
  });
135
+ if (this.nonInteractive && !args.some(arg => arg.startsWith('-input'))) {
136
+ extraArgs.push('-input=false');
137
+ }
133
138
  return [...extraArgs, ...args];
134
139
  }
135
140
  getVarDefs() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agilecustoms/envctl",
3
- "version": "1.10.5",
3
+ "version": "1.11.1",
4
4
  "description": "node.js CLI client for manage environments",
5
5
  "keywords": [
6
6
  "terraform wrapper",
@@ -45,17 +45,17 @@
45
45
  "run-core-status": " CWD=../tt-core npm run it -- status --verbose",
46
46
  "run-core-plan": " CWD=../tt-core npm run it -- plan -out=.terraform/plan",
47
47
  "run-core-deployp": "CWD=../tt-core npm run it -- deploy .terraform/plan",
48
- "run-core-deploy": " CWD=../tt-core npm run it -- deploy -var=\"env_size=min\"",
48
+ "run-core-deploy": " CWD=../tt-core npm run it -- deploy",
49
49
  "run-core-delete": " CWD=../tt-core npm run it -- delete",
50
50
  "run-core-destroy": "CWD=../tt-core npm run it -- destroy",
51
51
  "run-core-logs": " CWD=../tt-core npm run it -- logs",
52
52
  "*": "",
53
53
  "run-init": "cd ../tt-gitops && terraform init -upgrade -backend-config=key=laxa1986 -reconfigure",
54
54
  "run-status": " CWD=../tt-gitops npm run it -- status",
55
- "run-plan": " AWS_PROFILE=ac-tt-dev-deployer CWD=../tt-gitops npm run it -- plan -var=\"env_size=min\" -var-file=versions.tfvars",
55
+ "run-plan": " AWS_PROFILE=ac-tt-dev-deployer CWD=../tt-gitops npm run it -- plan -var-file=versions.tfvars",
56
56
  "run-deploy": " AWS_PROFILE=ac-tt-dev-deployer CWD=../tt-gitops npm run it -- deploy -var-file=versions.tfvars",
57
57
  "run-delete": " CWD=../tt-gitops npm run it -- delete",
58
- "run-destroy": "AWS_PROFILE=ac-tt-dev-destroyer CWD=../tt-gitops npm run it -- destroy -var=\"env_size=min\" -var-file=versions.tfvars",
58
+ "run-destroy": "AWS_PROFILE=ac-tt-dev-destroyer CWD=../tt-gitops npm run it -- destroy -var-file=versions.tfvars",
59
59
  "-": "",
60
60
  "run-ephemeral-create": " npm run it -- create-ephemeral --key test",
61
61
  "run-ephemeral-init": "cd ../tt-gitops && terraform init -upgrade -backend-config=key=test -reconfigure",