Updated latest SAM app version with TF integration module #9
Workflow file for this run
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
name: "TF template tests" | |
on: [workflow_dispatch, pull_request] | |
jobs: | |
ValidateTF: | |
runs-on: ubuntu-latest | |
name: "Validation (format & syntax)" | |
defaults: | |
run: | |
working-directory: ./ | |
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 . -type f -name "versions.tf" -not -path "*example*" -exec dirname {} \; | sort -u) | |
for dir in $dirs; do | |
echo "Running terraform init and validate in directory: $dir" | |
cd $dir | |
terraform init -input=false | |
terraform validate | |
cd - # Go back to the root directory | |
done | |
CHECKOV-SCAN: | |
runs-on: ubuntu-latest | |
name: "Security Scan" | |
defaults: | |
run: | |
working-directory: ./ | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Install Checkov | |
run: pip install checkov | |
- name: Find and run Checkov on Terraform modules | |
run: | | |
dirs=$(find . -type f -name "versions.tf" -not -path "*example*" -exec dirname {} \; | sort -u) | |
for dir in $dirs; do | |
echo "Running Checkov in directory: $dir" | |
checkov --directory $dir --quiet --framework terraform --output cli --download-external-modules true --skip-check CKV2_AWS_10,CKV2_AWS_6,CKV2_AWS_61,CKV2_AWS_62,CKV_AWS_115,CKV_AWS_117,CKV_AWS_144,CKV_AWS_145,CKV_AWS_158,CKV_AWS_173,CKV_AWS_18,CKV_AWS_21,CKV_AWS_240,CKV_AWS_241,CKV_AWS_252,CKV_AWS_26,CKV_AWS_27,CKV_AWS_272,CKV_AWS_338,CKV_AWS_35,CKV_AWS_36,CKV_AWS_50,CKV_AWS_67,CKV_GCP_83,CKV_TF_1,CKV_TF_2 | |
done |