This repository implements a skeleton repository for teams to use when first getting started with terraform. It uses terragrunt as a workflow tool.
For a step-by-step guide for how this repo was built, the why behind it, and how to use it, see this blog series:
https://thirstydeveloper.io/series/tf-skeleton
You will need:
- An AWS account for storing remote state in S3
- An IAM user in that account with
- Administrative access
- An IAM user tag
of
Terraformer
set toAdmin
- Credentials for the above IAM user configured in the terminal used for running
terraform
andterragrunt
commands
If you prefer to work from a very basic version of this skeleton that instead uses the local filesystem backend, use branch release/1.1.
This project uses:
- tfenv for managing terraform versions
- tgenv for managing terragrunt versions
- pre-commit for running syntax, semantic, and style checks on
git commit
After installing those tools run tfenv install
and tgenv install
from the
clone of this repository to install the configured versions of terraform and
terragrunt. Then, run pre-commit install
to install the pre-commit hooks.
- Create an AWS credentials profile
named
tf-admin-account
- Run
make init-admin
to deploy a CloudFormation stack to that account containing the infrastructure terraform needs to run
Run terragrunt
commands from directories under deployments/
containing
terragrunt.hcl
files.
terragrunt *-all
commands can be run from the repository root, or the
deployments/
and any directory underneath it. For instance:
- Run
terragrunt plan-all
from the repository root to generate terraform plans for all deployments. - Run
terragrunt plan-all
fromdeployments/app/dev
to generate plans for allapp/dev
deployments.
For additional guidance, see the companion blog series: