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
Terraformerset toAdmin
- Credentials for the above IAM user configured in the terminal used for running
terraformandterragruntcommands
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-adminto 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-allfrom the repository root to generate terraform plans for all deployments. - Run
terragrunt plan-allfromdeployments/app/devto generate plans for allapp/devdeployments.
For additional guidance, see the companion blog series: