@agilecustoms/envctl 1.26.0 → 1.27.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.
@@ -34,7 +34,7 @@ export class EnvService extends BaseService {
34
34
  }
35
35
  async init(tfArgs) {
36
36
  await this.terraformAdapter.init(tfArgs);
37
- await this.terraformAdapter.lockProviders();
37
+ await this.terraformAdapter.lockProviders(tfArgs);
38
38
  }
39
39
  async plan(tfArgs) {
40
40
  this.terraformAdapter.validateAndGetStateFile();
@@ -136,11 +136,30 @@ export class TerraformAdapter {
136
136
  const config = this.localStateService.load();
137
137
  this.localStateService.save(config);
138
138
  }
139
- async lockProviders() {
139
+ getVars(args) {
140
+ const result = [];
141
+ for (let i = 0; i < args.length; i++) {
142
+ const arg = args[i];
143
+ if (arg.startsWith('-var=') || arg.startsWith('-var-file=')) {
144
+ result.push(arg);
145
+ continue;
146
+ }
147
+ if (arg === '-var' || arg === '-var-file') {
148
+ result.push(arg);
149
+ if (i + 1 < args.length && !args[i + 1].startsWith('-')) {
150
+ result.push(args[i + 1]);
151
+ i++;
152
+ }
153
+ }
154
+ }
155
+ return result;
156
+ }
157
+ async lockProviders(args) {
140
158
  const linuxArm64 = process.platform === 'linux' && process.arch === 'arm64';
141
159
  if (!linuxArm64) {
142
160
  logger.info('Lock providers');
143
- await this.cli.run('terraform', ['providers', 'lock', '-platform=linux_arm64']);
161
+ const vars = this.getVars(args);
162
+ await this.cli.run('terraform', ['providers', 'lock', '-platform=linux_arm64', ...vars]);
144
163
  }
145
164
  const fileContent = this.getLockFile();
146
165
  const config = this.localStateService.load();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agilecustoms/envctl",
3
- "version": "1.26.0",
3
+ "version": "1.27.0",
4
4
  "description": "node.js CLI client for manage environments",
5
5
  "keywords": [
6
6
  "terraform wrapper",
@@ -82,7 +82,7 @@
82
82
  "-tt-": "",
83
83
  "tt-desc": "deploy TT project from local machine",
84
84
  "tt": "CWD=../tt-gitops AWS_PROFILE=ac-tt-dev-deployer npm run it --",
85
- "run-init": " npm run tt -- init -reconfigure -upgrade -backend-config=key=laxa1986",
85
+ "run-init": " npm run tt -- init -reconfigure -upgrade -backend-config=key=laxa1986 -var-file=versions.tfvars",
86
86
  "run-status": " npm run tt -- status",
87
87
  "run-apply": " npm run tt -- apply --auto-approve -var=env_size=min -var-file=versions.tfvars",
88
88
  "run-delete": " npm run tt -- delete"