Skip to content

Terraform Testing

Terraform Testing #35

Workflow file for this run

name: Terraform Testing
on:
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
Linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: hashicorp/setup-terraform@v3
- name: Terraform Docs
run: |
docker run --rm --volume "$(pwd):/terraform-docs" -u $(id -u) quay.io/terraform-docs/terraform-docs:0.20.0 --output-check /terraform-docs
- name: Terraform Format Check
run: |
terraform fmt -check -recursive
Terraform:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./.github/testing
steps:
- uses: actions/checkout@v4
- uses: hashicorp/setup-terraform@v3
- name: Terraform Init
run: terraform init
- name: Terraform Validate
run: terraform validate
- name: Terraform Apply
run: terraform apply -auto-approve -input=false
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
TF_VAR_account_id: ${{ secrets.TF_VAR_ACCOUNT_ID }}
- name: Terraform Destroy
run: terraform destroy -auto-approve -input=false
if: always()
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
TF_VAR_account_id: ${{ secrets.TF_VAR_ACCOUNT_ID }}