Skip to content

Terraform test framework #5

Terraform test framework

Terraform test framework #5

Workflow file for this run

name: 'Unit testing'
on:
pull_request:
branches:
- main
paths-ignore:
- 'examples/**'
- 'LICENSE'
- '**.md'
permissions:
id-token: write
contents: read
jobs:
terraform:
runs-on: ubuntu-latest
env:
ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }}
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }}
ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }}
# strategy:
# fail-fast: false
# matrix:
# terraform: [1.3.0]
steps:
- name: Download repository
uses: actions/checkout@v4
# - name: Download repository as module
# uses: actions/checkout@v4
# with:
# path: testing/pull_request/module
- name : Terraform fmt
run: terraform fmt -check
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: "~1.6.0" # ${{ matrix.terraform }}
- name: Terraform init
run: terraform init
- name: Terraform validate
run: terraform validate
- name: "Az CLI login"
uses: azure/login@v1
with:
tenant-id: ${{ secrets.ARM_TENANT_ID }}
client-id: ${{ secrets.ARM_CLIENT_ID }}
subscription-id: ${{ secrets.ARM_SUBSCRIPTION_ID }}
- name: Terraform test
run: terraform test
# - name: Terraform plan
# run: terraform plan -out=tfplan
# - name: Terraform apply
# id: terraformApply
# run: terraform apply tfplan
# - name: Terraform destroy
# if: ${{ (success() && steps.terraformApply.outcome == 'success') || (failure() && steps.terraformApply.outcome == 'failure') }}
# run: terraform destroy -auto-approve