chore: run 'terraform plan' via github action #20
Workflow file for this run
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 plan | |
| # TODO: only run when the contents of terraform/ have changed | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| permissions: | |
| id-token: write | |
| contents: read | |
| jobs: | |
| terraform-plan: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: terraform | |
| steps: | |
| - name: Check out the repository | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | |
| - name: Log in to azure using federated identity credentials | |
| uses: azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43 # v3 | |
| with: | |
| client-id: ${{ secrets.AZURE_SP_CLIENT_ID }} | |
| tenant-id: ${{ secrets.AZURE_SP_TENANT_ID }} | |
| subscription-id: ${{ secrets.AZURE_SP_SUBSCRIPTION_ID }} | |
| - name: Setup terraform | |
| uses: hashicorp/setup-terraform@dfe3c3f87815947d99a8997f908cb6525fc44e9e # v4 | |
| with: | |
| terraform_version: 1.14.5 | |
| - name: Initialize terraform and select workspace | |
| run: | | |
| terraform init -input=false -backend-config="subscription_id=${{ secrets.AZURE_SP_SUBSCRIPTION_ID }}" && \ | |
| terraform workspace select "dev" \ | |
| - name: Terraform Plan | |
| env: | |
| TF_VAR_ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SP_SUBSCRIPTION_ID }} | |
| run: terraform plan \ | |
| -var="CONTAINER_TAG=${{ github.sha }}" \ | |
| -lock=false |