Fogg is a code generator that standardizes terraform configuration across your infrastructure and makes it easier to manage smaller terraform workspaces and increase code reuse.
TL;DR
How fogg works / how to use it in a nutshell:
- Create a
fogg.yml
in the root of a new terraform repository. - Run
fogg apply
in the root of your repository to generate all the workspaces specified in thefogg.yml
file. In addition, fogg writes to each workspace:- a
Makefile
that acts as a smart proxy forterraform
cli commands - a
fogg.tf
that configures providers, default variables, state storage, and remote-state data sources for other workspaces in the repository.
- a
- Every time you make changes to
fogg.yml
, runfogg apply
to update the files that fogg manages. - Edit your terraform configuration in one of the workspaces that fogg created. Run
make plan
andmake apply
instead ofterraform plan/apply
to apply your changes. - Commit your code, including fogg-generated files.
Fogg concepts
Accounts, Environments and Components
Fogg encourages you to organize terraform configurations into accounts
and environments
. Environments are further subdivided into components
All of these workspaces support full Terraform functionality, but fogg creates remote state relationships differently in each case:
- The remote state for all
accounts
is accessible by all other workspaces in the repository - The remote state for a given
component
is accessible by allcomponents
in the sameenvironment
- Refer to another workspace’s remote state as
data.terraform_remote_state.{workspace_name}.outputs.{outputvar}
. This means that name collisions between account workspace names and component names are possible.
Remote state relationships
Features
- Configures remote state storage and locking in one place, and applies it to every workspace
- Standardizes repository layout and dependencies between workspaces