To use this repository you just need Docker and Docker Compose although it's possible to run commands within a local context of Terraform.
-
Either run
make setup
or:- Create
.env
file from.env.dist
- Create
docker-compose.local.yml
file fromdocker-compose.local.yml.dist
- Create
-
Populate
.env
file with basic values:ENVIRONMENT
: name of the environment to be deployed/managedAWS_ACCESS_KEY_ID
: AWS access key associated with an IAM user or roleAWS_SECRET_ACCESS_KEY
: AWS secret key associated with the access keyTERRAFORM_BACKEND_S3_BUCKET_NAME
: Name of S3 bucket for holding a state file
-
Run
make
ormake build
to build a Terraform Docker image -
Create S3 bucket for holding state files:
make backend-create
This repository contains a Makefile
, which main purpose is to wrap docker-compose
commands into single task.
Few tasks, that speed up development and testing:
make build
- build terraform docker image for local usagemake setup
- setup local repo for local usagemake backend-destroy
- destroy backend for the state files
And wrapped terraform commands:
make init
- initialise stackmake plan
- plan changesmake apply
- apply changes
To run other terraform commands, which are not in Makefile
, please run:
docker-compose run --rm terraform [COMMAND]
- Please don't store any secrets in state files if possible.
- Tag resources as much as possible, but don't go crazy
- Don't make stacks complex. Create a new one to simplify management of resources and reference them in other stacks when required
- Don't use default values for variables too often