Terragrunt and terraform template for aws projects
- Terraform: version ~> v1.2.0
- Terragrunt: version ~> v0.37.1
- Aws-vault: version ~> v6.3.1
- Edit $HOME/.terraformrc:
plugin_cache_dir = "$HOME/.terraform.d/plugins"
alias tg='terragrunt'
alias tgh='tg hclfmt'
alias tga='tgh && tg apply'
alias tgp='tgh && tg plan'
- aws-vault to get AWS Vars:
aws-vault exec ${project_name}
- Change account id in file account.hcl
- Change config in file terragrunt parent if you EC2 role instead of access key
- Update project spec in global.hcl
- Set environment from ENV before provisoning env's resources (Default is 'dev'):
## Test env:
export ENV=test
## Staging env:
export ENV=stage
## Production env:
export ENV=prod
- Then run:
(cd env/us-east-1/<resource-dir> && tg apply)