DevOps Hub for Terraform Automation
Clone or download
avozicov Merge pull request #373 from TerraHubCorp/stage
Add configure command and new google cloud templates
Latest commit 04af4db Oct 11, 2018


DevOps Hub for Terraform Automation

TerraHub is a terraform centric devops tool that simplifies provisioning and management at scale of cloud resources and cloud services across multiple cloud accounts. For example: Serverless on Amazon AWS, or Kubernetes on Google Cloud, or VMs on Microsoft Azure.

TerraHub CLI and TerraHub Console in Action


  1. Make it easier and faster to create reusable terraform configuration
  2. Simplify and distribute the way terraform configuration is executed
  3. Accelerate and automate the testing of terraform commands
  4. Integrate and manage any existing terraform configuration
  5. Centralize cloud resources management through realtime dashboards
  6. Streamline integration and deployment with built-in CI and CD processes
  7. NO NEED to expose your private network to outside world at all


TerraHub CLI is built using nodejs and published using npm. Quick steps to get started:

$ node -v
$ npm -v
$ npm install -g terrahub
└── terrahub@0.0.1
$ terrahub --help

NOTE: TerraHub CLI doesn't magically collect your data and upload to TerraHub API, which is visualized in TerraHub Console. In order to do that, please sign up for a free account at and navigate to Settings > Access to copy TerraHub token. Next, you can setup THUB_TOKEN environmental variable or update token value in $HOME/.terrahub/.terrahub.json global config file.

When running terrahub --help, you will get a list of commands, summarized below:

Command Description Status
# terrahub management
project create new or define existing folder as project that manages terraform configuration ✔️
component create new or include existing terraform configuration into current terrahub project ✔️
graph show dependencies graph for terraform configuration mapped as terrahub components ✔️
# terraform execution
apply run terraform apply across multiple terrahub components ✔️
destroy run terraform destroy across multiple terrahub components ✔️
init run terraform init across multiple terrahub components ✔️
output run terraform output across multiple terrahub components ✔️
plan run terraform plan across multiple terrahub components ✔️
refresh run terraform refresh across multiple terrahub components ✔️
show run terraform show across multiple terrahub components
workspace run terraform workspace across multiple terrahub components ✔️
# cloud automation
build build code used by terraform configuration (e.g. AWS Lambda, Google Functions) ✔️
run execute automated workflow terraform init > workspace > plan > apply ✔️
list list cloud resources by projects > accounts > regions > services > resources ✔️


You can use whatever structure you want, but we recommend you follow this one:

├─ .terrahub
│  ├─ s3
│  │  ├── .terrahub.yml
│  │  ├──
│  │  ├── default.tfvars
│  │  ├──
│  │  ├──
│  │  ├──
│  │  └──
│  ├─ cloudfront
│  │  ├── .terrahub.yml
│  │  ├──
│  │  ├── default.tfvars
│  │  ├──
│  │  ├──
│  │  ├──
│  │  └──
├─ .terrahub.yml
├─ src
└─ ...

One exception: No terraform scripts in root of your project!


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 output
  • 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):

"hooks": {
    "plan": {
        "before": "./hooks/plan/before.js",
        "after": "./hooks/plan/after.js"


  • Get rid of download npm module