Skip to content

Latest commit

 

History

History
51 lines (40 loc) · 858 Bytes

hooks.md

File metadata and controls

51 lines (40 loc) · 858 Bytes

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:
/**
 * @param {Object} moduleConfig
 * @returns {Promise}
 */
function hook(moduleConfig) {
  return Promise.resolve();
}

module.exports = hook;
  • after hook:
/**
 * @param {Object} moduleConfig
 * @param {Buffer} cmdResult
 * @returns {Promise}
 */
function hook(moduleConfig, cmdResult) {
  return Promise.resolve();
}

module.exports = hook;

Configuration example for plan (.terrahub.json):

"hook": {
    "plan": {
        "before": "./hook/plan/before.js",
        "after": "./hook/plan/after.js"
    }
}