fix!: Bump AWS provider #5
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: Terraform min-max | |
on: | |
pull_request: | |
concurrency: | |
# https://stackoverflow.com/questions/66335225/how-to-cancel-previous-runs-in-the-pr-when-you-push-new-commitsupdate-the-curre | |
group: ${{ github.workflow }}-${{ github.ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
collectDirectories: | |
name: π± collect directories | |
# Outputs a list of all unique directories | |
# that contain *.tf files and do not start with . | |
# For public repos use runs-on: ubuntu-latest | |
# For private repos use runs-on: self-hosted | |
runs-on: ubuntu-latest | |
outputs: | |
directories: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@v3 | |
- id: set-matrix | |
run: | | |
DIRS=$(find . -type f -name '*.tf' -not -path '**/.*' | sed -r 's|/[^/]+$||' | sort | uniq) | |
DIRS_JSON=$(jq -ncR '[inputs]' <<< "$DIRS") | |
cat <<< matrix=$DIRS_JSON >> $GITHUB_OUTPUT | |
cat $GITHUB_OUTPUT | |
validateTerraformMinMaxVersions: | |
name: ποΈ Validate Terraform min/max versions | |
needs: collectDirectories | |
# For public repos use runs-on: ubuntu-latest | |
# For private repos use runs-on: self-hosted | |
runs-on: ubuntu-latest | |
container: bjorncloudandthings/terraform-aws-github:latest | |
strategy: | |
matrix: | |
directory: ${{ fromJson(needs.collectDirectories.outputs.directories) }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Get Terraform min/max versions | |
id: minMax | |
uses: clowdhaus/[email protected] | |
with: | |
directory: ${{ matrix.directory }} | |
- name: Validate min Terraform version (${{ steps.minMax.outputs.minVersion }}) | |
run: | | |
ls -la ~ | |
tfenv install ${{ steps.minMax.outputs.minVersion }} | |
tfenv use ${{ steps.minMax.outputs.minVersion }} | |
terraform --version | |
terraform init -backend=false | |
terraform validate | |
- name: Validate max Terraform version (${{ steps.minMax.outputs.maxVersion }}) | |
run: | | |
ls -la ~ | |
tfenv install ${{ steps.minMax.outputs.maxVersion }} | |
tfenv use ${{ steps.minMax.outputs.maxVersion }} | |
terraform --version | |
terraform init -backend=false | |
terraform validate |