From 38c0e156f20b00d180596e429df0ab797262bbe9 Mon Sep 17 00:00:00 2001
From: Timo Furrer <tfurrer@gitlab.com>
Date: Wed, 13 Nov 2024 15:14:21 +0100
Subject: [PATCH] Rename internal `DEFAULT_TF_CONFIG_PATH` variable

---
 src/gitlab-tofu.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gitlab-tofu.sh b/src/gitlab-tofu.sh
index dd1b8f8..80a82db 100644
--- a/src/gitlab-tofu.sh
+++ b/src/gitlab-tofu.sh
@@ -25,6 +25,7 @@
 # ----------------------------------
 # TF_HTTP_USERNAME: username for the HTTP backend. Defaults to `gitlab-ci-token`.
 # TF_HTTP_PASSWORD: password for the HTTP backend. Defaults to `$CI_JOB_TOKEN`.
+# TF_CLI_CONFIG_FILE: will not overwrite if set. Defaults to `$HOME/.terraformrc` if it exists.
 #
 # Respected GitLab CI/CD Variables:
 # > these are variables exposed by
@@ -178,11 +179,10 @@ export TF_VAR_ci_project_url="${TF_VAR_ci_project_url:-${CI_PROJECT_URL}}"
 # Use terraform automation mode (will remove some verbose unneeded messages)
 export TF_IN_AUTOMATION=true
 
-DEFAULT_TF_CONFIG_PATH="$HOME/.terraformrc"
-
 # Set a Terraform CLI Configuration File
-if [ -z "${TF_CLI_CONFIG_FILE}" ] && [ -f "${DEFAULT_TF_CONFIG_PATH}" ]; then
-  export TF_CLI_CONFIG_FILE="${DEFAULT_TF_CONFIG_PATH}"
+default_tf_cli_config_file="$HOME/.terraformrc"
+if [ -z "${TF_CLI_CONFIG_FILE}" ] && [ -f "${default_tf_cli_config_file}" ]; then
+  export TF_CLI_CONFIG_FILE="${default_tf_cli_config_file}"
 fi
 
 
-- 
GitLab