Prerequisites
- 2 Terraform projects with remote backends - example repo
- 2 pairs of AWS keys
Create 2 digger.yml files
Placedigger.prod.yml
and digger.dev.yml
files in the root of your repo. Point dir
to folders with terraform
Create 2 environments in GitHub
- In your GitHub repo, go to Settings > Environments
- Press “New Environment”
- Name one “development” and another “production”
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
Create 2 Actions workflow files
.github/workflows/digger-run-dev.yml
for dev.github/workflows/digger-run-prod.yml
for prod
environment
and the Rename step from Dev to Prod
Verify that it works
That’s it! Now you can use Digger to automate your Terraform PRs.- Create a PR that changes terraform in one of your projects
- You should see 2 Actions jobs started
- Shortly after, a comment with plan output for the affected project will be added
- You can comment
digger apply
to apply changes - If you do so, another Action job will start to run apply