From 2973f85f3ba5f8f5b4610cce9b01a7ce26510c84 Mon Sep 17 00:00:00 2001 From: gravitybacklight <2327204+gravitybacklight@users.noreply.github.com> Date: Thu, 21 Oct 2021 15:13:34 +0100 Subject: [PATCH] feat: add __GIT_WORKING_DIR__ to tfsec (#255) --- README.md | 7 +++++++ terraform_tfsec.sh | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bead61f68..637d66b82 100644 --- a/README.md +++ b/README.md @@ -372,7 +372,14 @@ Example: --no-color -e aws-s3-enable-bucket-logging,aws-s3-specify-public-access-block ``` +4. Like terraform_tflint, `__GIT_WORKING_DIR__` can be used when specifying files relative to the git working directory: +Example: + + ```yaml + - id: terraform_tfsec + args: [--args=--config-file=__GIT_WORKING_DIR__/.tfsec.json] + ``` ### terraform_validate diff --git a/terraform_tfsec.sh b/terraform_tfsec.sh index c742f3215..0dc01fe10 100755 --- a/terraform_tfsec.sh +++ b/terraform_tfsec.sh @@ -54,7 +54,8 @@ parse_cmdline_() { case $argv in -a | --args) shift - ARGS+=("$1") + expanded_arg="${1//__GIT_WORKING_DIR__/$PWD}" + ARGS+=("$expanded_arg") shift ;; --)