-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
84e2062
commit feb5c37
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: "TF template tests" | ||
on: [workflow_dispatch, pull_request] | ||
|
||
jobs: | ||
|
||
ValidateTF: | ||
runs-on: ubuntu-latest | ||
name: "Validatation (format & syntax)" | ||
defaults: | ||
run: | ||
working-directory: ./aws | ||
steps: | ||
- uses: actions/checkout@v4 | ||
name: Checkout source code | ||
|
||
- uses: hashicorp/setup-terraform@v3 | ||
name: Setup Terraform | ||
|
||
- name: Initialize and Validate Terraform Modules | ||
run: | | ||
# Find all directories inside the 'aws' directory that contain Terraform files | ||
dirs=$(find aws -type f -name "*.tf" -exec dirname {} \; | sort -u) | ||
for dir in $dirs; do | ||
echo "Running terraform init and validate in directory: $dir" | ||
cd $dir | ||
terraform fmt -check -recursive -diff | ||
terraform init -input=false | ||
terraform validate | ||
cd - # Go back to the root directory | ||
done |