Skip to content
This repository was archived by the owner on May 6, 2020. It is now read-only.

Commit 0662f89

Browse files
authored
Fixing error processing files with TF_LOG set (#93)
* Terraform 0.11 format fixes * Stderr is the issue * Fixing error with processing file with TF_LOG set
1 parent bd8f895 commit 0662f89

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/terraform_fmt.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function terraformFmt {
99

1010
# Gather the output of `terraform fmt`.
1111
echo "fmt: info: checking if Terraform files in ${tfWorkingDir} are correctly formatted"
12-
fmtOutput=$(terraform fmt -check -write=false -diff ${fmtRecursive} 2>&1)
12+
fmtOutput=$(terraform fmt -check=true -write=false -diff ${fmtRecursive} 2>&1)
1313
fmtExitCode=${?}
1414

1515
# Exit code of 0 indicates success. Print the output and exit.
@@ -33,15 +33,15 @@ function terraformFmt {
3333
echo "${fmtOutput}"
3434
echo
3535
echo "fmt: error: the following files in ${tfWorkingDir} are incorrectly formatted"
36-
fmtFileList=$(terraform fmt -check -write=false -list -recursive 2>&1)
36+
fmtFileList=$(terraform fmt -check=true -write=false -list ${fmtRecursive})
3737
echo "${fmtFileList}"
3838
echo
3939

4040
# Comment on the pull request if necessary.
4141
if [ "$GITHUB_EVENT_NAME" == "pull_request" ] && [ "${tfComment}" == "1" ]; then
4242
fmtComment=""
4343
for file in ${fmtFileList}; do
44-
fmtFileDiff=$(terraform fmt -check -write=false -diff "$file" | sed -n '/@@.*/,//{/@@.*/d;p}')
44+
fmtFileDiff=$(terraform fmt -check=true -write=false -diff "${file}" | sed -n '/@@.*/,//{/@@.*/d;p}')
4545
fmtComment="${fmtComment}
4646
<details><summary><code>${tfWorkingDir}/${file}</code></summary>
4747

0 commit comments

Comments
 (0)