Merge branch 'main' of https://github.com/HTTPArchive/dataform #4
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 Apply on Changes | |
| on: | |
| push: | |
| branches: | |
| - main | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| terraform: | |
| name: Terraform | |
| runs-on: ubuntu-latest | |
| env: | |
| GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| persist-credentials: false | |
| - name: Authenticate with Google Cloud | |
| uses: google-github-actions/auth@v3 | |
| with: | |
| project_id: "httparchive" | |
| credentials_json: ${{ env.GCP_SA_KEY }} | |
| - name: Set up Terraform | |
| uses: hashicorp/setup-terraform@v3.1.2 | |
| - name: Terraform Format Check | |
| working-directory: ./infra | |
| run: terraform fmt -check | |
| - name: Initialize Terraform | |
| working-directory: ./infra | |
| run: terraform init | |
| - name: Validate Terraform | |
| working-directory: ./infra | |
| run: terraform validate | |
| - name: Plan Terraform | |
| working-directory: ./infra | |
| run: terraform plan -out=tfplan | |
| - name: Apply Terraform | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| working-directory: ./infra | |
| run: terraform apply -auto-approve tfplan |