Skip to content

Commit 518cb29

Browse files
authored
Merge branch 'master' into renovate/github-codeql-action-3.x
2 parents e6ed4ad + 0dac002 commit 518cb29

File tree

6 files changed

+31
-11
lines changed

6 files changed

+31
-11
lines changed

.github/workflows/ci-cd.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ jobs:
110110
steps:
111111
- name: Switch to using Python 3.13 by default
112112
# yamllint disable-line rule:line-length
113-
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
113+
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
114114
with:
115115
python-version: 3.13
116116
- name: Check out src from Git
@@ -275,7 +275,7 @@ jobs:
275275
steps:
276276
- name: Switch to using Python 3.13
277277
# yamllint disable-line rule:line-length
278-
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
278+
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
279279
with:
280280
python-version: 3.13
281281

.github/workflows/pre-commit.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
ref: ${{ github.event.pull_request.head.sha }}
5757
# Skip terraform_tflint which interferes to commit pre-commit auto-fixes
5858
# yamllint disable-line rule:line-length
59-
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
59+
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
6060
with:
6161
python-version: '3.9'
6262
- name: Execute pre-commit

.github/workflows/reusable-tox.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ jobs:
159159
by default
160160
id: python-install
161161
# yamllint disable-line rule:line-length
162-
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
162+
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
163163
with:
164164
python-version: ${{ inputs.python-version }}
165165

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [1.97.3](https://github.com/antonbabenko/pre-commit-terraform/compare/v1.97.2...v1.97.3) (2025-02-04)
6+
7+
8+
### Bug Fixes
9+
10+
* **`terraform_docs`:** Fix bug introduced in `v1.97.2` ([#801](https://github.com/antonbabenko/pre-commit-terraform/issues/801)) ([64b81f4](https://github.com/antonbabenko/pre-commit-terraform/commit/64b81f449344ed72d180d57ce0a801389c018584)), closes [#796](https://github.com/antonbabenko/pre-commit-terraform/issues/796)
11+
512
## [1.97.2](https://github.com/antonbabenko/pre-commit-terraform/compare/v1.97.1...v1.97.2) (2025-02-03)
613

714

hooks/_common.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ function common::initialize {
5252
function common::parse_cmdline {
5353
# common global arrays.
5454
# Populated via `common::parse_cmdline` and can be used inside hooks' functions
55-
ARGS=() HOOK_CONFIG=() FILES=()
55+
ARGS=()
56+
HOOK_CONFIG=()
57+
FILES=()
5658
# Used inside `common::terraform_init` function
5759
TF_INIT_ARGS=()
5860
# Used inside `common::export_provided_env_vars` function

hooks/terraform_docs.sh

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ function terraform_docs {
160160
# `--hook-config=--path-to-file=` if it set
161161
local config_output_file
162162
# Get latest non-commented `output.file` from `.terraform-docs.yml`
163-
config_output_file=$(grep -A1000 -e '^output:$' "$config_file" | grep -E '^[[:space:]]+file:' | tail -n 1) || true
163+
config_output_file=$(grep -A1000 -e '^output:$' "$config_file" 2> /dev/null | grep -E '^[[:space:]]+file:' | tail -n 1) || true
164164

165165
if [[ $config_output_file ]]; then
166166
# Extract filename from `output.file` line
@@ -176,7 +176,7 @@ function terraform_docs {
176176

177177
# Use `.terraform-docs.yml` `output.mode` if it set
178178
local config_output_mode
179-
config_output_mode=$(grep -A1000 -e '^output:$' "$config_file" | grep -E '^[[:space:]]+mode:' | tail -n 1) || true
179+
config_output_mode=$(grep -A1000 -e '^output:$' "$config_file" 2> /dev/null | grep -E '^[[:space:]]+mode:' | tail -n 1) || true
180180
if [[ $config_output_mode ]]; then
181181
# Extract mode from `output.mode` line
182182
output_mode=$(echo "$config_output_mode" | awk -F':' '{print $2}' | tr -d '[:space:]"' | tr -d "'")
@@ -240,10 +240,21 @@ function terraform_docs {
240240
have_marker=$(grep -o "$insertion_marker_begin" "$output_file") || unset have_marker
241241
[[ ! $have_marker ]] && popd > /dev/null && continue
242242
fi
243-
local config_options
244-
[[ $have_config_flag == true ]] && config_options="--config=$config_file"
245-
# shellcheck disable=SC2086
246-
terraform-docs --output-mode="$output_mode" --output-file="$output_file" $tf_docs_formatter "$config_options" $args ./ > /dev/null
243+
244+
# shellcheck disable=SC2206
245+
# Need to pass $tf_docs_formatter and $args as separate arguments, not as single string
246+
local tfdocs_cmd=(
247+
terraform-docs
248+
--output-mode="$output_mode"
249+
--output-file="$output_file"
250+
$tf_docs_formatter
251+
$args
252+
)
253+
if [[ $have_config_flag == true ]]; then
254+
"${tfdocs_cmd[@]}" "--config=$config_file" ./ > /dev/null
255+
else
256+
"${tfdocs_cmd[@]}" ./ > /dev/null
257+
fi
247258

248259
popd > /dev/null
249260
done

0 commit comments

Comments
 (0)