I build this project to learn Supabase, npm, monorepo, IaC (via Terraform and Pulumi), GitHub Actions, and other tooling.
This repo includes a minimal Terraform setup to manage the repository configuration itself via GitHub Actions.
What you get:
- Terraform plan on Pull Requests that change
infra/terraform/** - Terraform apply on merges to
main
Files:
.github/workflows/terraform.yml– CI workflow for plan/applyinfra/terraform– Terraform config that targets this repository
Setup:
- Ensure Actions can manage repo settings. By default the
GITHUB_TOKENworks for many read actions, but for write operations on certain org settings you may need a fine-scoped PAT as a repository secret namedGH_TOKENorACTIONS_DEPLOY_KEY. This scaffold uses the defaultGITHUB_TOKEN. If you hit permission errors, create a classic PAT withreposcope (and org admin:write if needed) and add it asGH_TOKEN. Then setenvfor the steps that need it:GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}. - Open a PR that modifies files under
infra/terraform/. The workflow will runplanand post a comment. - Merge to
mainto auto-apply.
Local usage (optional):
- Install Terraform >= 1.5
- Export env vars and run init/plan:
export GITHUB_TOKEN=...(use a PAT or a fine-grained token)terraform -chdir=infra/terraform initterraform -chdir=infra/terraform plan -var="github_owner=<owner>" -var="repo_name=<this-repo-name>"
Notes:
- The Terraform config references the existing repository via a data source. Add resources (e.g., branch protections, rulesets) to manage settings in a safe, declarative way.