@agilecustoms/envctl 1.25.0 → 1.25.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.
|
@@ -51,7 +51,7 @@ export class EnvService extends BaseService {
|
|
|
51
51
|
async plan(tfArgs) {
|
|
52
52
|
this.terraformAdapter.validateAndGetStateFile();
|
|
53
53
|
const key = this.terraformAdapter.getKey();
|
|
54
|
-
this.terraformAdapter.
|
|
54
|
+
this.terraformAdapter.validateAndGetLockFile();
|
|
55
55
|
await this.terraformAdapter.plan(key, tfArgs);
|
|
56
56
|
}
|
|
57
57
|
async createEphemeral(key) {
|
|
@@ -71,7 +71,7 @@ export class EnvService extends BaseService {
|
|
|
71
71
|
async apply(tfArgs) {
|
|
72
72
|
const { stateFile, stateUpdated } = this.terraformAdapter.validateAndGetStateFile();
|
|
73
73
|
const key = this.terraformAdapter.getKey();
|
|
74
|
-
const { lockFile, lockUpdated } = this.terraformAdapter.
|
|
74
|
+
const { lockFile, lockUpdated } = this.terraformAdapter.validateAndGetLockFile();
|
|
75
75
|
const applyMode = getApplyMode(tfArgs);
|
|
76
76
|
let env = await this.getEnv(key);
|
|
77
77
|
if (env === null) {
|
|
@@ -108,7 +108,7 @@ export class TerraformAdapter {
|
|
|
108
108
|
config.stateHash = fileHash;
|
|
109
109
|
return { stateFile: fileContent, stateUpdated };
|
|
110
110
|
}
|
|
111
|
-
|
|
111
|
+
getLockFile() {
|
|
112
112
|
const lockPath = path.join(process.cwd(), '.terraform.lock.hcl');
|
|
113
113
|
if (!fs.existsSync(lockPath)) {
|
|
114
114
|
throw new KnownException(`Terraform lock file not found at: ${lockPath}`);
|
|
@@ -120,8 +120,8 @@ export class TerraformAdapter {
|
|
|
120
120
|
throw new KnownException(`Failed to read terraform lock file: ${lockPath}`, { cause });
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
|
|
124
|
-
const fileContent = this.
|
|
123
|
+
validateAndGetLockFile() {
|
|
124
|
+
const fileContent = this.getLockFile();
|
|
125
125
|
const config = this.localStateService.load();
|
|
126
126
|
const fileHash = hash(fileContent);
|
|
127
127
|
if (fileHash !== config.lockFileHash) {
|
|
@@ -141,7 +141,7 @@ export class TerraformAdapter {
|
|
|
141
141
|
logger.info('Lock providers');
|
|
142
142
|
await this.cli.run('terraform', ['providers', 'lock', '-platform=linux_arm64']);
|
|
143
143
|
}
|
|
144
|
-
const fileContent = this.
|
|
144
|
+
const fileContent = this.getLockFile();
|
|
145
145
|
const config = this.localStateService.load();
|
|
146
146
|
config.lockFileHash = hash(fileContent);
|
|
147
147
|
this.localStateService.save(config);
|