From 30b74af078485fa7fad31f50898a6a98f63a4873 Mon Sep 17 00:00:00 2001
From: Timo Furrer <tfurrer@gitlab.com>
Date: Wed, 13 Nov 2024 20:55:05 +0100
Subject: [PATCH] Rename `terraform_init` function to `tofu_init`

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

diff --git a/src/gitlab-tofu.sh b/src/gitlab-tofu.sh
index 947bac3..439fdb6 100644
--- a/src/gitlab-tofu.sh
+++ b/src/gitlab-tofu.sh
@@ -251,7 +251,7 @@ GITLAB_TOFU_IMPLICIT_INIT=${GITLAB_TOFU_IMPLICIT_INIT:-true}
 # Allows users to continue the actual command in case init failed
 GITLAB_TOFU_IGNORE_INIT_ERRORS=${GITLAB_TOFU_IGNORE_INIT_ERRORS:-false}
 
-terraform_init() {
+tofu_init() {
   # If GITLAB_TOFU_INIT_NO_RECONFIGURE is not set to 'true',
   # a `-reconfigure` flag is added to the `terraform init` command.
   if [ "$GITLAB_TOFU_INIT_NO_RECONFIGURE" != 'true' ]; then
@@ -278,7 +278,7 @@ if [ $sourced -eq 0 ]; then
 
   case "${1}" in
     "apply")
-      $GITLAB_TOFU_IMPLICIT_INIT && terraform_init
+      $GITLAB_TOFU_IMPLICIT_INIT && tofu_init
       if [ "$GITLAB_TOFU_APPLY_NO_PLAN" = false ]; then
         tofu "${tf_chdir_opt}" "${@}" -input=false -auto-approve "${GITLAB_TOFU_PLAN_CACHE}"
       else
@@ -287,7 +287,7 @@ if [ $sourced -eq 0 ]; then
       fi
     ;;
     "destroy")
-      $GITLAB_TOFU_IMPLICIT_INIT && terraform_init
+      $GITLAB_TOFU_IMPLICIT_INIT && tofu_init
       tofu "${tf_chdir_opt}" "${@}" -auto-approve
     ;;
     "fmt")
@@ -296,7 +296,7 @@ if [ $sourced -eq 0 ]; then
     "init")
       # shift argument list „one to the left“ to not call 'terraform init init'
       shift
-      terraform_init "${@}"
+      tofu_init "${@}"
     ;;
     "plan")
       plan_args=''
@@ -304,7 +304,7 @@ if [ $sourced -eq 0 ]; then
         plan_args='-detailed-exitcode'
       fi
 
-      $GITLAB_TOFU_IMPLICIT_INIT && terraform_init
+      $GITLAB_TOFU_IMPLICIT_INIT && tofu_init
       # shellcheck disable=SC2086
       tofu "${tf_chdir_opt}" "${@}" -input=false -out="${GITLAB_TOFU_PLAN_CACHE}" ${var_file_args} ${plan_args} && ret=$? || ret=$?
 
@@ -325,17 +325,17 @@ if [ $sourced -eq 0 ]; then
       tofu "${tf_chdir_opt}" show -json "${GITLAB_TOFU_PLAN_CACHE}" | jq -r "${jq_plan}" > "${GITLAB_TOFU_PLAN_JSON}"
     ;;
     "validate")
-      $GITLAB_TOFU_IMPLICIT_INIT && terraform_init -backend=false
+      $GITLAB_TOFU_IMPLICIT_INIT && tofu_init -backend=false
       # shellcheck disable=SC2086
       tofu "${tf_chdir_opt}" "${@}" ${var_file_args}
     ;;
     "test")
-      $GITLAB_TOFU_IMPLICIT_INIT && terraform_init -backend=false
+      $GITLAB_TOFU_IMPLICIT_INIT && tofu_init -backend=false
       # shellcheck disable=SC2086
       tofu "${tf_chdir_opt}" "${@}" ${var_file_args}
     ;;
     "graph")
-      $GITLAB_TOFU_IMPLICIT_INIT && terraform_init
+      $GITLAB_TOFU_IMPLICIT_INIT && tofu_init
       # shellcheck disable=SC2086
       tofu "${tf_chdir_opt}" "${@}" ${var_file_args}
     ;;
-- 
GitLab