Skip to content

Commit

Permalink
fix: regex for variables and outputs didn't work correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
yohanb committed Dec 10, 2024
1 parent 18c510a commit 89e9d7b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
entry: hooks/vars-in-variables-files/check
language: script
files: \.tf$
exclude: ^variables\..*\.tf$
exclude: ^variables[\.]{0,1}.*\.tf$

- id: outputs-in-outputs-files
name: "Ensure outputs are in `outputs[.grouping].tf`"
description: "Errors if a outputs is defined in a file that does not start with `outputs.`"
entry: hooks/outputs-in-outputs-files/check
language: script
files: \.tf$
exclude: ^outputs\..*\.tf$
exclude: ^outputs[\.]{0,1}.*\.tf$

- id: provider-pinned-versions
name: "Ensures provider versions are pinned.`"
Expand Down
4 changes: 4 additions & 0 deletions hooks/vars-in-variables-files/fixtures/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
variable "test" {
default = "test"
description = "Simple variable"
}
3 changes: 3 additions & 0 deletions hooks/vars-in-variables-files/test
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ script_directory="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"

echo "testing: $script_directory"

echo "testing: check $script_directory/fixtures/variables.tf"
"$script_directory/check" "$script_directory/fixtures/variables.tf"

echo "testing: check $script_directory/fixtures/variables.function.tf"
"$script_directory/check" "$script_directory/fixtures/variables.function.tf"

Expand Down

0 comments on commit 89e9d7b

Please sign in to comment.