diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index d77c26bea..07cdf4b82 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -120,4 +120,4 @@ require_serial: true files: \.tf$ pass_filenames: false - args: ["terraform"] + args: ["--args=terraform"] diff --git a/README.md b/README.md index de5d862c1..4f1bdb28a 100644 --- a/README.md +++ b/README.md @@ -635,8 +635,8 @@ Out of the box tfupdate will pin the terraform version - id: tfupdate name: tfupdate provider vsphere args: - - provider - - vsphere + - --args=provider + - --args=vsphere ``` See the `tfupdate --help` command line help for available options. No need to pass `--recursive .` as it is added automatically diff --git a/hooks/tfupdate.sh b/hooks/tfupdate.sh index c79bf8143..668326705 100755 --- a/hooks/tfupdate.sh +++ b/hooks/tfupdate.sh @@ -8,14 +8,18 @@ source "$SCRIPT_DIR/_common.sh" function main { common::initialize "$SCRIPT_DIR" - tfupdate_ "$@" + common::parse_cmdline "$@" + # shellcheck disable=SC2153 # False positive + + tfupdate_ "${ARGS[*]}" + } ####################################################################### # tfupdate_ ####################################################################### function tfupdate_ { - local -r args=$* + local -r args="$1" # pass the arguments to hook # shellcheck disable=SC2086 # Double quote to prevent globbing and word splitting. tfupdate ${args} --recursive .