Skip to content

Made changes in terraform checks file. #1

Made changes in terraform checks file.

Made changes in terraform checks file. #1

name: Terraform Checks

Check failure on line 1 in .github/workflows/terraform-checks.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/terraform-checks.yaml

Invalid workflow file

(Line: 28, Col: 20): Unexpected value '', (Line: 29, Col: 9): Unexpected value 'Terraform Validate Example Files', (Line: 30, Col: 12): Unexpected value 'ubuntu-latest', (Line: 32, Col: 5): Unexpected value 'fail-fast', (Line: 33, Col: 5): Unexpected value 'matrix', (Line: 32, Col: 5): There's not enough info to determine what you meant. Add one of these properties: cancel-timeout-minutes, container, continue-on-error, defaults, env, environment, outputs, runs-on, secrets, services, snapshot, steps, timeout-minutes, uses, with, (Line: 39, Col: 5): Unexpected value 'run', (Line: 39, Col: 5): There's not enough info to determine what you meant. Add one of these properties: cancel-timeout-minutes, container, continue-on-error, defaults, env, environment, outputs, runs-on, secrets, services, snapshot, steps, timeout-minutes, uses, with, (Line: 43, Col: 5): A sequence was not expected
on:
workflow_call:
env:
TERRAFORM_DOCS_VERSION: v0.18.0
TFLINT_VERSION: v0.52.0
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: "1.8.4"
- name: Initialize Terraform
id: init
run: terraform init -input=false
- name: Terraform Test
id: fmt
run: terraform test
validateExamples:
name: Terraform Validate Example Files
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
example:
- examples/same-account
- examples/cross-account
- examples/complete
defaults:
run:
working-directory: ${{ matrix.example }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: "1.6.0"
- name: Terraform Init
run: terraform init -input=false
- name: Terraform Validate
run: terraform validate
collectInputs:
name: Collect workflow inputs
needs: test
runs-on: ubuntu-latest
outputs:
directories: ${{ steps.dirs.outputs.directories }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get root directories
id: dirs
uses: clowdhaus/terraform-composite-actions/directories@v1.9.0
preCommitMinVersions:
name: Min TF pre-commit
needs: collectInputs
runs-on: ubuntu-latest
strategy:
matrix:
directory: ${{ fromJson(needs.collectInputs.outputs.directories) }}
steps:
# https://github.com/orgs/community/discussions/25678#discussioncomment-5242449
- name: Delete huge unnecessary tools folder
run: |
rm -rf /opt/hostedtoolcache/CodeQL
rm -rf /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk
rm -rf /opt/hostedtoolcache/Ruby
rm -rf /opt/hostedtoolcache/go
- name: Checkout
uses: actions/checkout@v4
- name: Terraform min/max versions
id: minMax
uses: clowdhaus/terraform-min-max@v1.3.0
with:
directory: ${{ matrix.directory }}
- name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}
# Run only validate pre-commit check on min version supported
if: ${{ matrix.directory != '.' }}
uses: clowdhaus/terraform-composite-actions/pre-commit@v1.9.0
with:
terraform-version: ${{ steps.minMax.outputs.minVersion }}
tflint-version: ${{ env.TFLINT_VERSION }}
args: 'terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*'
- name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}
# Run only validate pre-commit check on min version supported
if: ${{ matrix.directory == '.' }}
uses: clowdhaus/terraform-composite-actions/pre-commit@v1.9.0
with:
terraform-version: ${{ steps.minMax.outputs.minVersion }}
tflint-version: ${{ env.TFLINT_VERSION }}
args: 'terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)'
preCommitMaxVersion:
name: Max TF pre-commit
runs-on: ubuntu-latest
needs: collectInputs
steps:
# https://github.com/orgs/community/discussions/25678#discussioncomment-5242449
- name: Delete huge unnecessary tools folder
run: |
rm -rf /opt/hostedtoolcache/CodeQL
rm -rf /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk
rm -rf /opt/hostedtoolcache/Ruby
rm -rf /opt/hostedtoolcache/go
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Terraform min/max versions
id: minMax
uses: clowdhaus/terraform-min-max@v1.3.0
- name: Pre-commit Terraform ${{ steps.minMax.outputs.maxVersion }}
uses: clowdhaus/terraform-composite-actions/pre-commit@v1.9.0
with:
terraform-version: ${{ steps.minMax.outputs.maxVersion }}
tflint-version: ${{ env.TFLINT_VERSION }}
terraform-docs-version: ${{ env.TERRAFORM_DOCS_VERSION }}
install-hcledit: true