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 planis run and shown as a PR comment. - If
/applyis sent as a comment in that PR,terraform applyis run. - The
/applycommand only works after someone from theCODEOWNERShas approved this PR. - Merging the PR does not trigger anything else.
⚠ Fork PRs: Since I use
GITHUB_TOKENto 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: