diff --git a/test/terraform/input-descriptions.bats b/test/terraform/input-descriptions.bats index 2ceeece..bcadb17 100644 --- a/test/terraform/input-descriptions.bats +++ b/test/terraform/input-descriptions.bats @@ -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" ] } diff --git a/test/terraform/lib.bash b/test/terraform/lib.bash index 06d5546..cb868c2 100644 --- a/test/terraform/lib.bash +++ b/test/terraform/lib.bash @@ -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 } diff --git a/test/terraform/output-descriptions.bats b/test/terraform/output-descriptions.bats index 62eea59..effdbfe 100644 --- a/test/terraform/output-descriptions.bats +++ b/test/terraform/output-descriptions.bats @@ -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" ] }