diff --git a/src/gitlab-tofu.sh b/src/gitlab-tofu.sh index dd1b8f84bf65417b4d04f7386776cd58c5ad6adf..80a82db6caec13eee6ece2719dcde01048d88f14 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