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.ymlin the root of a new terraform repository. - Run
fogg applyin the root of your repository to generate all the workspaces specified in thefogg.ymlfile. In addition, fogg writes to each workspace:- a
Makefilethat acts as a smart proxy forterraformcli commands - a
fogg.tfthat 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 applyto update the files that fogg manages. - Edit your terraform configuration in one of the workspaces that fogg created. Run
make planandmake applyinstead ofterraform plan/applyto 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
accountsis accessible by all other workspaces in the repository - The remote state for a given
componentis accessible by allcomponentsin 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