Skip to content

Commit

Permalink
Fix terraform-docs (#10)
Browse files Browse the repository at this point in the history
* Fix terraform-docs

* Fix terraform-docs
  • Loading branch information
aknysh authored Jan 21, 2020
1 parent 6a4b2b3 commit 476eb96
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
2 changes: 1 addition & 1 deletion test/terraform/input-descriptions.bats
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function teardown() {
@test "check if terraform inputs have descriptions" {
skip_unless_terraform
terraform_docs json . > $TMPFILE
run bash -c "jq -rS '.Inputs[] | select (.Description == \"\") | .Name + \" is missing a description\"' < $TMPFILE"
run bash -c "jq -rS '.inputs[] | select (.description == \"\" or .description == null) | .name + \" is missing a description\"' < $TMPFILE"
log "$output"
[ -z "$output" ]
}
11 changes: 1 addition & 10 deletions test/terraform/lib.bash
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,8 @@ function skip_unless_terraform() {
}

function terraform_docs() {
local TMP_FILE
which awk 2>&1 >/dev/null || ( echo "awk not available"; exit 1)
which terraform 2>&1 >/dev/null || ( echo "terraform not available"; exit 1)
which terraform-docs 2>&1 >/dev/null || ( echo "terraform-docs not available"; exit 1)

if [[ "`terraform version | head -1`" =~ 0\.12 ]]; then
TMP_FILE="$(mktemp /tmp/terraform-docs-XXXXXXXXXX.tf)"
awk -f ${BATS_TEST_DIRNAME}/terraform-docs.awk $2/*.tf > ${TMP_FILE}
terraform-docs $1 ${TMP_FILE}
rm -f ${TMP_FILE}
else
terraform-docs $1 $2
fi
terraform-docs --no-providers --no-header $1 $2
}
2 changes: 1 addition & 1 deletion test/terraform/output-descriptions.bats
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function teardown() {
@test "check if terraform outputs have descriptions" {
skip_unless_terraform
terraform_docs json . > $TMPFILE
run bash -c "jq -rS '.Outputs[] | select (.Description == \"\") | .Name + \" is missing a description\"' < $TMPFILE"
run bash -c "jq -rS '.outputs[] | select (.description == \"\" or .description == null) | .name + \" is missing a description\"' < $TMPFILE"
log "$output"
[ -z "$output" ]
}

0 comments on commit 476eb96

Please sign in to comment.