Skip to content

Pin dependencies

Pin dependencies #142

name: Static Analysis
on:
push:
jobs:
static_analysis:
runs-on: ubuntu-22.04
steps:
# from https://github.com/actions/checkout/commits/main
- uses: actions/checkout@1f9a0c22da41e6ebfa534300ef656657ea2c6707
- name: init_terraform_folders
# env:
# FOLDERS: >
# src/core
# src/eks-platform
# src/domains/domain1-app
# src/domains/domain1-common
# src/domains/domain2-app
# src/domains/domain2-common
env:
FOLDERS: >
src/init
src/core
src/eks-platform
src/domains/example_microservice_apigateway
src/domains/example_microservice_cache
src/domains/example_microservice_cloudfront
src/domains/example_microservice_dynamodb
src/domains/example_microservice_kafka
src/domains/example_microservice_rds
run: |
pids=()
TAG=$(cat .terraform-version)
for f in $FOLDERS; do
pushd "$(pwd)/${f}"
sed -i -e 's/ backend "s3" {}//g' 00_main.tf # use local backend
docker run -v $(pwd):/tmp -w /tmp hashicorp/terraform:$TAG init &
pids+=($!)
popd
done
# Wait for each specific process to terminate.
# Instead of this loop, a single call to 'wait' would wait for all the jobs
# to terminate, but it would not give us their exit status.
#
for pid in "${pids[@]}"; do
#
# Waiting on a specific PID makes the wait command return with the exit
# status of that process. Because of the 'set -e' setting, any exit status
# other than zero causes the current shell to terminate with that exit
# status as well.
#
wait "$pid"
done
- name: run_pre_commit_terraform
run: |
TAG="v1.77.1@sha256:8734ffdd73f8648a7ea130b58330ccf7d781a6584ed82dd1de27b19873125816"
docker run -v $(pwd):/lint -w /lint ghcr.io/antonbabenko/pre-commit-terraform:$TAG run -a