Skip to content

Commit

Permalink
fixe refresh if skip is true
Browse files Browse the repository at this point in the history
  • Loading branch information
euliancom committed Oct 18, 2021
1 parent 0dfa74f commit 17a1875
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/helpers/wrappers/abstract-terrahub.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class AbstractTerrahub {
logger.warn(`Action '${this._action}' for '${this._config.name}' was skipped due to ` +
`'No changes. Infrastructure is up-to-date.'`);

return this._runTerraformCommand('refresh').catch(err => console.log(err.message || err));
return res;
});
} else {
return this._getTask();
Expand Down
26 changes: 19 additions & 7 deletions src/helpers/wrappers/terraform.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,12 +344,24 @@ class Terraform {
fse.outputFileSync(backupPath, planContent);
}

return Promise.resolve({
buffer: buffer,
skip: skip,
metadata: metadata,
status: Dictionary.REALTIME.SUCCESS
});
if (!skip) {
return Promise.resolve({
buffer: buffer,
skip: skip,
metadata: metadata,
status: Dictionary.REALTIME.SUCCESS
});
}

return this.run('refresh', args.concat(this._varFile(), this._var()))
.then(() => {
return Promise.resolve({
buffer: buffer,
skip: skip,
metadata: metadata,
status: Dictionary.REALTIME.SUCCESS
});
});
});
}

Expand Down Expand Up @@ -535,7 +547,7 @@ class Terraform {
* @return {Promise}
*/
refresh() {
const options = { '-backup': this._metadata.getStateBackupPath(), '-input': false, '-lock': false };
const options = { '-backup': this._metadata.getStateBackupPath(), '-input': false, '-lock': false };

const localBackend = [];
const { template } = this._config;
Expand Down

0 comments on commit 17a1875

Please sign in to comment.