Skip to content

Commit d77ffc3

Browse files
Fix bug in generate_docs function
The generate_docs function would attempt to run terraform_docs against the autogen/ directory. Since that directory contains templates instead of actual working Terraform, the terraform-docs command failed, causing no docs to be properly formatted. These changes update the function to properly ignore the ./autogen directory.
1 parent d597d4a commit d77ffc3

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

test/make.sh

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,12 @@
1818
# shebang has a '- e' flag, which causes it
1919
# to exit on error
2020
function check_bash() {
21-
find . -name "*.sh" | while IFS= read -d '' -r file;
22-
do
23-
if [[ "$file" != *"bash -e"* ]];
24-
then
25-
echo "$file is missing shebang with -e";
26-
exit 1;
27-
fi;
28-
done;
21+
find . -name "*.sh" | while IFS= read -d '' -r file; do
22+
if [[ "$file" != *"bash -e"* ]]; then
23+
echo "$file is missing shebang with -e"
24+
exit 1
25+
fi
26+
done
2927
}
3028

3129
# This function makes sure that the required files for
@@ -92,8 +90,8 @@ function generate_docs() {
9290
echo "Generating markdown docs with terraform-docs"
9391
TMPFILE=$(mktemp)
9492
#shellcheck disable=2006,2086
95-
for j in `for i in $(find . -type f | grep \.tf$) ; do dirname $i ; done | sort -u` ; do
96-
terraform-docs markdown "$j" > "$TMPFILE"
93+
for j in $(find ./ -name '*.tf' -type f -exec dirname '{}' \; | sort -u | grep -v ./autogen); do
94+
terraform-docs markdown "$j" >"$TMPFILE"
9795
python helpers/combine_docfiles.py "$j"/README.md "$TMPFILE"
9896
done
9997
rm -f "$TMPFILE"

0 commit comments

Comments
 (0)