Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added the ability to specify tfswitch dir #777

Merged
merged 1 commit into from
Oct 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion module-assets/ci/install-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ else
mkdir -p "${DIRECTORY}"
fi

# Optionally specify the directory to run tfswitch in. If not speciffied it will run in repo root dir
if [[ -z "${TFSWITCH_DIRECTORY}" ]]; then
TFSWITCH_DIR="."
else
TFSWITCH_DIR="${TFSWITCH_DIRECTORY}"
fi

# Determine OS type
if [[ $OSTYPE == 'darwin'* ]]; then
OS="darwin"
Expand Down Expand Up @@ -225,7 +232,7 @@ ${arg} rm -f "${DIRECTORY}/${BINARY}"

# If a .tf file with the terraform constrain is detected in the current directory, it should automatically download or switch to the latest terraform version in the defined range.
# Otherwise it will default to TERRAFORM_VERSION value defined above
tfswitch --default "${TERRAFORM_VERSION:1}" --bin "${TMP_DIR}/${BINARY}"
tfswitch --default "${TERRAFORM_VERSION:1}" --bin "${TMP_DIR}/${BINARY}" --chdir "${TFSWITCH_DIR}"
actual_binary_location=$(which "${TMP_DIR}/${BINARY}")
copy_replace_binary ${BINARY} "$(dirname "${actual_binary_location}")"
clean "${TMP_DIR}"
Expand Down