Managing Multiple Environments

Terraform Enterprise makes it easy to use one configuration across multiple environments. This lets organizations have identical topologies across staging, QA, and production. Each environment uses variables to set environment specific values, such as the number of machines, but still maintains the same topology.

The base Terraform configuration is stored in GitHub. Then multiple environments can be created in Terraform Enterprise which point to this configuration. Each environment has a unique set of variables which allow the environments to be different, but still have the same topology.

When the configuration is changed in GitHub, the proposed change can be tested in staging and QA before promoting to production. This ensures that changes can be safely tested and deployed.

  1. Store your Terraform configuration in a GitHub repo
  2. Create a new environment in Terraform Enterprise
  3. Connect this environment to the GitHub repo
  4. Repeat steps 2 and 3 to add more environments
  5. Update the Terraform configuration in GitHub and test the change across environments

Check out the multiple-envs repo for a real world walkthrough of deploying infrastructure changes to multiple environments.