shared-actions/terraform-validate
Michael Seele bd5e3add23
All checks were successful
validate-shared-actions / validate-shared-actions (pull_request) Successful in 1m18s
Aikido Security PR Check / Aikido Security Scan (pull_request) Successful in 2m27s
feat: add mock-files input to create empty files for Terraform validation
2026-05-21 13:50:14 +00:00
..
action.yml feat: add mock-files input to create empty files for Terraform validation 2026-05-21 13:50:14 +00:00
README.md feat: add mock-files input to create empty files for Terraform validation 2026-05-21 13:50:14 +00:00

terraform-validate

Validate Terraform configuration files using the official Terraform CLI.

Inputs

Input Required Default Description
terraform-dir No terraform Directory containing .tf files
terraform-version No ~1.15 Terraform version to use
workspace No "" Terraform workspace to use
jfrog-token No "" JFrog Artifactory token for the Terraform provider registry (TF_TOKEN_schmalz_jfrog_io)
mock-files No "" Newline-separated list of file paths (relative to repo root) to create as empty files before validation. Useful when Terraform uses file() references that do not exist in CI.

Usage

- uses: https://schmalz-git.git.onstackit.cloud/schmalz/shared-actions/terraform-validate@terraform-validate-v1
  with:
    workspace: stage
    jfrog-token: ${{ secrets.JFROG_TOKEN }}

With mock files for file() dependencies:

- uses: https://schmalz-git.git.onstackit.cloud/schmalz/shared-actions/terraform-validate@terraform-validate-v1
  with:
    workspace: stage
    jfrog-token: ${{ secrets.JFROG_TOKEN }}
    mock-files: |
      config/app.json
      secrets/tls.crt
      secrets/tls.key

Notes

  • Runs terraform init -backend=false, terraform fmt -check -recursive, and terraform validate.
  • Sets TF_WORKSPACE during validate if workspace is provided.
  • Sets TF_TOKEN_schmalz_jfrog_io on both init and validate steps if jfrog-token is provided.
  • When mock-files is set, empty files are created at the given paths (including any missing parent directories) before terraform init runs. This allows validation of configurations that reference external files via file().