Here is quick HOWTO use terragrunt with multiple environments.
Requirements:
- git
- terraform
- terragrunt
- gcloud
- kubectl (version from gcloud is ok)
- helm
- Please follow "Before you begin" part of GCP manual
Terragrunt allows to store terraform manifests separately from terraform [sensitive] values and support multiple environments.
In this example we have 3 envs - dev,staging, and prod.
Adjust all the terragrunt.hcl
files to suit your environments.
Let's deploy staging env. Start from infra deployment.
- Init
cd examples/live/staging/infra
terragrunt init
- Check terraform plan
terragrunt plan
- Apply changes, it takes some time, 10-30min
terragrunt apply -auto-approve
We should get infrastrucrute similar to following scheme
Similar for basic preparations inside k8s
cd examples/live/staging/in-k8s
terragrunt init
terragrunt plan
terragrunt apply -auto-approve
- Destroy all the staff, when required
cd examples/live/staging/infra
terragrunt destroy