mirror of
https://github.com/tofuutils/pre-commit-opentofu.git
synced 2025-10-15 17:38:54 +02:00
Added support for TFLint with --deep parameter (#53)
Added support for TFLint (https://github.com/wata727/tflint). Signed-off-by: Costin Galan <costin.galan@mambu.com>
This commit is contained in:
parent
dc8cf48441
commit
e0d3d61422
2 changed files with 31 additions and 0 deletions
|
|
@ -42,6 +42,14 @@
|
|||
files: (\.tf|\.tfvars)$
|
||||
exclude: \.terraform\/.*$
|
||||
|
||||
- id: terraform_tflint
|
||||
name: Terraform validate with tflint
|
||||
description: Validates all Terraform configuration files with TFLint.
|
||||
entry: terraform_tflint.sh
|
||||
language: script
|
||||
files: (\.tf|\.tfvars)$
|
||||
exclude: \.terraform\/.*$
|
||||
|
||||
- id: terragrunt_fmt
|
||||
name: Terragrunt fmt
|
||||
description: Rewrites all Terragrunt configuration files to a canonical format.
|
||||
|
|
|
|||
23
terraform_tflint.sh
Executable file
23
terraform_tflint.sh
Executable file
|
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
declare -a paths
|
||||
declare -a tfvars_files
|
||||
|
||||
index=0
|
||||
|
||||
for file_with_path in "$@"; do
|
||||
file_with_path="${file_with_path// /__REPLACED__SPACE__}"
|
||||
|
||||
paths[index]=$(dirname "$file_with_path")
|
||||
|
||||
let "index+=1"
|
||||
done
|
||||
|
||||
for path_uniq in $(echo "${paths[*]}" | tr ' ' '\n' | sort -u); do
|
||||
path_uniq="${path_uniq//__REPLACED__SPACE__/ }"
|
||||
|
||||
pushd "$path_uniq" > /dev/null
|
||||
tflint --deep
|
||||
popd > /dev/null
|
||||
done
|
||||
Loading…
Add table
Add a link
Reference in a new issue