Skip to content

Quada

Quada #68

---
name: 'Terraform PRs for Azure'
on:
pull_request:
paths:
- '.github/workflows/azure_terraform_plan.yml'
- 'azure/terraform/stacks/**'
permissions:
contents: read
id-token: write
pull-requests: write
jobs:
terraform:
name: 'Terraform PR Plan'
env:
ARM_CLIENT_ID: ${{ secrets.AZURE_AD_CLIENT_ID }}
ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
ARM_TENANT_ID: ${{ secrets.AZURE_AD_TENANT_ID }}
ARM_USE_OIDC: true
TF_WORKSPACE: prod
TF_IN_AUTOMATION: true
TF_INPUT: 0
runs-on: ubuntu-latest
strategy:
matrix:
stack:
- acm-general
defaults:
run:
shell: bash
working-directory: azure/terraform/stacks/${{ matrix.stack }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Azure CLI setup
uses: azure/login@v1
with:
client-id: ${{ env.ARM_CLIENT_ID }}
tenant-id: ${{ env.ARM_TENANT_ID }}
subscription-id: ${{ env.ARM_SUBSCRIPTION_ID }}
- name: 'Terraform Format'
id: fmt
uses: dflook/terraform-fmt-check@v1
with:
path: "azure/terraform/stacks/${{ matrix.stack }}"
workspace: ${{ env.TF_WORKSPACE }}
- name: 'Terraform Validate'
id: validate
uses: dflook/terraform-validate@v1
with:
path: "azure/terraform/stacks/${{ matrix.stack }}"
workspace: ${{ env.TF_WORKSPACE }}
- name: 'Terraform Plan'
id: plan
uses: dflook/terraform-plan@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
path: "azure/terraform/stacks/${{ matrix.stack }}"
workspace: ${{ env.TF_WORKSPACE }}
var_file: "azure/terraform/stacks/${{ matrix.stack }}/configuration/${{ env.TF_WORKSPACE }}.tfvars"