Skip to content
Open
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ clang-format supports.
### Terraform

- `terraform-format`: built-in formatter (using [OpenTofu](https://opentofu.org/)'s [`fmt`](https://opentofu.org/docs/cli/commands/fmt/))
- [tflint](https://github.com/terraform-linters/tflint)
- `terraform-lint`: built-in linter (using [tflint](https://github.com/terraform-linters/tflint))

### YAML

Expand Down
9 changes: 5 additions & 4 deletions modules/hooks.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3344,12 +3344,13 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.ormol
entry = "${hooks.terraform-format.package}/bin/terraform-fmt";
files = "\\.tf$";
};
tflint =
terraform-lint =
{
name = "tflint";
name = "terraform-lint";
description = "A Pluggable Terraform Linter.";
package = tools.tflint;
entry = "${hooks.tflint.package}/bin/tflint";
package = tools.terraform-lint;
extraPackages = [ pkgs.tflint ];
entry = "${hooks.terraform-lint.package}/bin/terraform-lint";
files = "\\.tf$";
};
topiary =
Expand Down
28 changes: 28 additions & 0 deletions nix/terraform-lint/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
writeShellApplication,
coreutils,
tflint,
}:

writeShellApplication {
name = "terraform-lint";

runtimeInputs = [
tflint
coreutils
];

text = ''
red='\033[0;31m'
none='\033[0m'

for arg in "$@"; do
echo -en "$red$arg$none "
if ! tflint --chdir "$(dirname "$arg")" --filter "$(basename "$arg")"; then
fail=true
fi
done

[[ -v fail ]] && exit 1
'';
}
10 changes: 0 additions & 10 deletions nix/tflint/default.nix

This file was deleted.

2 changes: 1 addition & 1 deletion nix/tools.nix
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ in
hunspell = callPackage ./hunspell { };
purty = callPackage ./purty { purty = nodePackages.purty; };
terraform-fmt = callPackage ./terraform-fmt { };
tflint = callPackage ./tflint { };
terraform-lint = callPackage ./terraform-lint { };
dune-build-opam-files = callPackage ./dune-build-opam-files { dune = dune_3; inherit (pkgsBuildBuild) ocaml; };
dune-fmt = callPackage ./dune-fmt { dune = dune_3; inherit (pkgsBuildBuild) ocaml; };
latexindent = tex;
Expand Down