• Docs
  • Features
  • Hooks

Hooks

Hooks can be used to run commands or set environment variables pre and post Workflows. Pre and post hooks are only executed a single time during a Terrateam Operation. Commands are executed from the repository checkout directory $TERRATEAM_ROOT.

Terrateam Runtime Configuration

Terrateam behavior can be configured via a config.yml. This file is located in a directory named .terrateam at the root of your Terraform repository: .terrateam/config.yml.

See Configuration documentation for details.

Configuration

Top-level key: hooks

See Configuration Reference documentation for details.

KeyTypeDescription
planPlanPre and post hook configuration for Plan operations.
applyApplyPre and post hook configuration for Apply operations.

Default configuration:

hooks:
  plan:
    pre: []
    post: []
  apply:
    pre: []
    post: []
Plan

Plan

KeyTypeDescription
prePreCommands to run before a plan workflow.
postPostCommands to run after a plan workflow.

Pre

Commands to run before a Plan workflow.

KeyTypeDescription
typeStringPre-hook type: env, run.
Env
KeyTypeDescription
nameStringName of environment variable.
cmdListCommand to use to set environment variable.
trim_trailing_newlinesBooleanTrim trailing newlines. Default is true.
Run
KeyTypeDescription
cmdListCommand to run from the directory that Terrateam is operating against.
run_onStringRun the command on step success, failure, or always. Default is success.
capture_outputBooleanWhen capture_output is set to true, command output is included in the GitHub pull request comment on a failure. Sensitive data is not masked. Be aware, this data is sent back to the Terrateam backend for processing. Default is false.

Post

Commands to run after a Plan workflow.

KeyTypeDescription
typeStringPost-hook type: env, run.
Env
KeyTypeDescription
nameStringName of environment variable.
cmdListCommand to use to set environment variable.
trim_trailing_newlinesBooleanTrim trailing newlines. Default is true.
Run
KeyTypeDescription
cmdListCommand to run from the directory that Terrateam is operating against.
run_onStringRun the command on step success, failure, or always. Default is success.
capture_outputBooleanWhen capture_output is set to true, command output is included in the GitHub pull request comment on a failure. Sensitive data is not masked. Be aware, this data is sent back to the Terrateam backend for processing. Default is false.
Apply

Apply

KeyTypeDescription
prePreCommands to run before an apply workflow.
postPostCommands to run after an apply workflow.

Pre

Commands to run before a Apply workflow.

KeyTypeDescription
typeStringPre-hook type: env, run.
Env
KeyTypeDescription
nameStringName of environment variable.
cmdListCommand to use to set environment variable.
trim_trailing_newlinesBooleanTrim trailing newlines. Default is true.
Run
KeyTypeDescription
cmdListCommand to run from the directory that Terrateam is operating against.
run_onStringRun the command on step success, failure, or always. Default is success.
capture_outputBooleanWhen capture_output is set to true, command output is included in the GitHub pull request comment on a failure. Sensitive data is not masked. Be aware, this data is sent back to the Terrateam backend for processing. Default is false.

Post

Commands to run after a pply workflow.

KeyTypeDescription
typeStringPost-hook type: env, run.
Env
KeyTypeDescription
nameStringName of environment variable.
cmdListCommand to use to set environment variable.
trim_trailing_newlinesBooleanTrim trailing newlines. Default is true.
Run
KeyTypeDescription
cmdListCommand to run from the directory that Terrateam is operating against.
run_onStringRun the command on step success, failure, or always. Default is success.
capture_outputBooleanWhen capture_output is set to true, command output is included in the GitHub pull request comment on a failure. Sensitive data is not masked. Be aware, this data is sent back to the Terrateam backend for processing. Default is false.

Use Cases