about summary refs log tree commit diff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/depotfmt.nix9
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/depotfmt.nix b/tools/depotfmt.nix
index d1a1cb425ae3..c3c9852430af 100644
--- a/tools/depotfmt.nix
+++ b/tools/depotfmt.nix
@@ -3,6 +3,12 @@
 { depot, pkgs, ... }:
 
 let
+  # terraform fmt can't handle multiple paths at once, but treefmt
+  # expects this
+  terraformat = pkgs.writeShellScript "terraformat" ''
+    echo "$@" | xargs -n1 ${pkgs.terraform}/bin/terraform fmt
+  '';
+
   config = pkgs.writeText "depot-treefmt-config" ''
     [formatter.go]
     command = "${pkgs.go}/bin/gofmt"
@@ -10,8 +16,7 @@ let
     includes = ["*.go"]
 
     [formatter.tf]
-    command = "${pkgs.terraform}/bin/terraform"
-    options = [ "fmt" ]
+    command = "${terraformat}"
     includes = [ "*.tf" ]
   '';