Reconcile Terraform state with actual state of AWS #304
Workflow file for this run
This file contains hidden or 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: 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 |