From 1eefe341ced563ed2a12713b76351e6079cf08c6 Mon Sep 17 00:00:00 2001 From: Adar Nimrod <nimrod@shore.co.il> Date: Thu, 29 Apr 2021 01:09:18 +0300 Subject: [PATCH] First iteration. Still need to skip modules that were already checked. --- VERSION | 1 + tff | 5 +++++ tfv | 11 +++++++++++ 3 files changed, 17 insertions(+) create mode 100644 VERSION diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..8acdd82 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.0.1 diff --git a/tff b/tff index 1d4850b..cf69077 100755 --- a/tff +++ b/tff @@ -2,3 +2,8 @@ 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 diff --git a/tfv b/tfv index 1d4850b..5d9f1b6 100755 --- a/tfv +++ b/tfv @@ -2,3 +2,14 @@ set -eu command -v terraform >/dev/null || { echo "Can't find the terraform binary, aborting." >&2; exit 1; } + +export TF_INPUT='0' +export TF_IN_AUTOMATION='1' + +for i in "$@" +do + terraform init -backend=false "$(dirname "$i")" || { code='1'; continue; } + terraform validate "$(dirname "$i")" || code='1' +done + +exit "${code:-0}" -- GitLab