Version 2.0.0 #3
Workflow file for this run
This file contains 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: "Testing module" | |
on: | |
push: | |
branches: [main] | |
paths-ignore: | |
- "examples/**" | |
- "LICENSE" | |
- "**.md" | |
pull_request: | |
branches: [main] | |
paths-ignore: | |
- "examples/**" | |
- "LICENSE" | |
- "**.md" | |
jobs: | |
terraform: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
defaults: | |
run: | |
working-directory: testing | |
steps: | |
- name: Download repository | |
uses: actions/checkout@v3 | |
- name: Download repository as module | |
uses: actions/checkout@v3 | |
with: | |
path: testing/module | |
- name: "Az CLI login" | |
uses: azure/login@v1 | |
env: | |
ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }} | |
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }} | |
ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }} | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v2 | |
with: | |
terraform_version: 1.3.0 | |
- name: Terraform init | |
run: terraform init | |
- name: Terraform fmt | |
run: terraform fmt -check | |
- name: Terraform validate | |
run: terraform validate | |
- 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 |