feat(terraform): manage NEXT_PUBLIC_BACKEND via Terraform #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Terraform CI/CD | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "infra/terraform/**" | |
| - "render.yaml" | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - "infra/terraform/**" | |
| jobs: | |
| terraform: | |
| name: Terraform Plan & Apply | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: infra/terraform | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Terraform | |
| uses: hashicorp/setup-terraform@v3 | |
| with: | |
| cli_config_credentials_token: ${{ secrets.TFC_API_TOKEN }} | |
| - name: Terraform Format | |
| id: fmt | |
| run: terraform fmt -check | |
| - name: Terraform Init | |
| id: init | |
| run: terraform init | |
| - name: Terraform Validate | |
| id: validate | |
| run: terraform validate -no-color | |
| - name: Terraform Plan | |
| id: plan | |
| if: github.event_name == 'pull_request' | |
| run: terraform plan -no-color -input=false | |
| env: | |
| TF_VAR_vercel_api_token: ${{ secrets.VERCEL_API_TOKEN }} | |
| TF_VAR_cloudflare_api_token: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| TF_VAR_cloudflare_zone_id: ${{ secrets.CLOUDFLARE_ZONE_ID }} | |
| - name: Terraform Apply | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| run: terraform apply -auto-approve -input=false | |
| env: | |
| TF_VAR_vercel_api_token: ${{ secrets.VERCEL_API_TOKEN }} | |
| TF_VAR_cloudflare_api_token: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| TF_VAR_cloudflare_zone_id: ${{ secrets.CLOUDFLARE_ZONE_ID }} |