This repo shows a simple static_site.tf
that creates an tiny
index.html
using a GCP bucket. Instead of calling terraform apply
locally (on the
developer's laptop) or on some CI, we want to give a bit more interactivity
and use the "ChatOps" approach which brings a higher level of transparency
(who did what and when). This idea comes from using
Prow, the
ChatOps bot that powers all Kubernetes repositories.
It goes like this:
- When a PR is opened,
terraform plan
is run and shown as a PR comment. - If
/apply
is sent as a comment in that PR,terraform apply
is run. - The
/apply
command only works after someone from theCODEOWNERS
has approved this PR. - Merging the PR does not trigger anything else.
⚠ Fork PRs: Since I use
GITHUB_TOKEN
to create/update the bot's comments, it won't work for PRs created from forks (see GITHUB_TOKEN restrictions)
Here is what it looks like in a live PR: