From 7b4dbd486dec3174127be2fce7884129e99a243e Mon Sep 17 00:00:00 2001 From: Peter Rifel Date: Fri, 29 Oct 2021 10:34:38 -0500 Subject: [PATCH] Check for hardcoded partitions in integration tests --- hack/verify-terraform.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hack/verify-terraform.sh b/hack/verify-terraform.sh index d605a7e7ce..5016f734b6 100755 --- a/hack/verify-terraform.sh +++ b/hack/verify-terraform.sh @@ -31,6 +31,15 @@ while IFS= read -r -d '' -u 3 test_dir; do echo -e "${test_dir}\n" docker run --rm --network host -e "TF_PLUGIN_CACHE_DIR=${PROVIDER_CACHE}" -v "${PROVIDER_CACHE}:${PROVIDER_CACHE}" -v "${test_dir}":"${test_dir}" -w "${test_dir}" --entrypoint=sh hashicorp/terraform:${TF_TAG} -c '/bin/terraform init -upgrade >/dev/null && /bin/terraform validate' || RC=$? + + if grep -qr "arn:aws:" "${test_dir}"; then + echo -e "\nARN reference uses hardcoded partition in ${test_dir}\n" + RC=1 + fi + if grep -qr "arn::" "${test_dir}"; then + echo -e "\nARN reference is missing partition in ${test_dir}\n" + RC=1 + fi done 3< <(find "${KOPS_ROOT}/tests/integration/update_cluster" -maxdepth 1 -type d -print0) if [ $RC != 0 ]; then