Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/workflows/call-terraform-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ on:
default: false
required: true
type: boolean
working-directory:
description: "Directory holding the Terraform configuration under test, relative to the repository root (for repositories where it is not at the root)"
default: "."
type: string
test-directory:
description: "Directory containing tftest.hcl files"
description: "Directory containing tftest.hcl files, relative to working-directory"
default: tests
type: string
verbose:
Expand All @@ -41,8 +45,9 @@ jobs:
fetch-depth: '0'

- name: Run terraform test
working-directory: ${{ inputs.working-directory }}
run: |
terraform init
terraform test \
-test-directory=${{ inputs.test-directory }} \
${{ inputs.verbose == 'true' && '-verbose' || '' }}
${{ inputs.verbose && '-verbose' || '' }}
16 changes: 13 additions & 3 deletions .github/workflows/call-validate-terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ on:
default: false
required: true
type: boolean
working-directory:
description: "Directory holding the Terraform configuration, relative to the repository root (for repositories where it is not at the root)"
default: "."
type: string
fmt-check:
description: "Fail when files are not formatted (terraform fmt -check -diff -recursive). Off by default, which keeps the previous behaviour: fmt rewrites the runner's checkout and never fails"
default: false
type: boolean

jobs:
Terraform-Validate:
Expand All @@ -33,9 +41,10 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- run: |
- working-directory: ${{ inputs.working-directory }}
run: |
terraform init
terraform fmt
terraform fmt ${{ inputs.fmt-check && '-check -diff -recursive' || '' }}
terraform validate

Terraform-Lint:
Expand All @@ -47,6 +56,7 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- run: |
- working-directory: ${{ inputs.working-directory }}
run: |
ls -lta
tflint --recursive