From 3e66537478d45c0df556bcc33666dcd827f1748d Mon Sep 17 00:00:00 2001 From: Adrian Stobbe Date: Tue, 28 Nov 2023 12:20:07 +0100 Subject: [PATCH] fix no tf lockfiles for excludedLockDirs --- bazel/ci/terraform.sh.in | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bazel/ci/terraform.sh.in b/bazel/ci/terraform.sh.in index 6d94da9842..bdc557683c 100644 --- a/bazel/ci/terraform.sh.in +++ b/bazel/ci/terraform.sh.in @@ -71,7 +71,7 @@ check() { for exclude in "${excludeLockDirs[@]}"; do for i in "${!terraformLockModules[@]}"; do if [[ ${terraformLockModules[i]} == "${BUILD_WORKSPACE_DIRECTORY}/${exclude}"* ]]; then - echo " ${terraformLockModules[i]}" + echo "${terraformLockModules[i]}" unset 'terraformLockModules[i]' fi done @@ -119,6 +119,11 @@ check() { ${terraform} -chdir="${module}" fmt -recursive > /dev/null ${terraform} -chdir="${module}" validate > /dev/null rm -rf "${module}/.terraform" + echo "Deleting lock files in the following directories:" # init generates lockfiles which should only be generated in the generate mode. + for dir in "${excludeLockDirs[@]}"; do + echo " ${dir}" + find "${dir}" -name '*.lock.hcl' -type f -delete + done done ;;