#!/bin/sh
set -eu

command -v terraform >/dev/null || { echo "Can't find the terraform binary, aborting." >&2; exit 1; }

for i in "$@"
do
    terraform fmt "$(dirname "$i")" || true
done