Skip to content

add name as iam role prefix #18

add name as iam role prefix

add name as iam role prefix #18

Workflow file for this run

name: Terraform Validation
on:
push:
branches:
- main
pull_request:
jobs:
find-directories:
name: Find Terraform Directories
runs-on: ubuntu-latest
outputs:
directories: ${{ steps.get-dirs.outputs.dirs }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Find directories with Terraform projects
id: get-dirs
run: |
dirs=$(find . -type f -name "*.tf" -print0 | xargs -0 -n1 dirname | sort -u)
dirs_json=$(echo "$dirs" | jq -R -s -c 'split("\n")[:-1]')
echo "Found directories: $dirs_json"
echo "::set-output name=dirs::$dirs_json"
env:
PATH: /usr/bin:/bin
validate:
name: Validate Terraform Projects
needs: find-directories
runs-on: ubuntu-latest
strategy:
matrix:
directory: ${{ fromJson(needs.find-directories.outputs.directories) }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
- name: Validate Terraform in directory
working-directory: ${{ matrix.directory }}
run: |
echo "Validating Terraform configuration in '${{ matrix.directory }}'"
terraform init -backend=false
terraform validate