Skip to content

Reconcile Terraform state with actual state of AWS #304

Reconcile Terraform state with actual state of AWS

Reconcile Terraform state with actual state of AWS #304

name: Check Terraform
on:
push:
branches:
- main
paths:
- 'terraform/**'
- 'terraform-bootstrap/**'
pull_request:
paths:
- 'terraform/**'
- 'terraform-bootstrap/**'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: "~1.9.7"
- name: Lint Terraform code
run: terraform fmt -check -diff -recursive
validate:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
directory:
- terraform/production
- terraform/staging
- terraform-bootstrap
defaults:
run:
working-directory: ${{ matrix.directory }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Get Terraform Version
id: tf_version
run: echo "value=$(cat .terraform-version)" >> $GITHUB_OUTPUT
- name: Install Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ steps.tf_version.outputs.value }}
- name: Initialize Terraform (offline only)
run: terraform init -backend=false
- name: Validate Terraform code
run: terraform validate