Skip to content

Scheduled Terraform Test #1

Scheduled Terraform Test

Scheduled Terraform Test #1

name: Scheduled Terraform Test
on:
schedule:
- cron: "0 0 * * *" # Runs every day at midnight UTC
workflow_dispatch: # Allows manual triggering
jobs:
terratest:
name: Run Terratest
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.17'
- name: Install Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_version: 1.1.5
- name: Install dependencies
run: |
go mod tidy
- name: Run Terratest
run: |
cd test
go test -v
terraform-compliance:
name: Run Terraform Compliance
runs-on: ubuntu-latest
needs: terratest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: 0.13.1
- name: Terraform Init
run: terraform init -backend=false
working-directory: ./example
- name: Terraform Plan
run: terraform plan -out=tfplan -input=false
working-directory: ./example
- name: Install terraform-compliance
run: |
pip install terraform-compliance
- name: Run terraform-compliance
run: terraform-compliance -p ./example/tfplan -f ./compliance/features