TerraHub Hooks
In order to provide you the best experience we have implemented hooks functionality for following actions:
  • terraform init
  • terraform workspace
  • terraform plan
  • terraform apply
  • terraform destroy
All the hooks should return a Promise and look like:
  • before hook:
1
/**
2
* @param {Object} moduleConfig
3
* @returns {Promise}
4
*/
5
function hook(moduleConfig) {
6
return Promise.resolve();
7
}
8
9
module.exports = hook;
Copied!
  • after hook:
1
/**
2
* @param {Object} moduleConfig
3
* @param {Buffer} cmdResult
4
* @returns {Promise}
5
*/
6
function hook(moduleConfig, cmdResult) {
7
return Promise.resolve();
8
}
9
10
module.exports = hook;
Copied!
Configuration example for plan (.terrahub.json):
1
"hook": {
2
"plan": {
3
"before": "./hook/plan/before.js",
4
"after": "./hook/plan/after.js"
5
}
6
}
Copied!
Copy link