Skip to content
Snippets Groups Projects
Unverified Commit 30b74af0 authored by Timo Furrer's avatar Timo Furrer
Browse files

Rename `terraform_init` function to `tofu_init`

Changelog: changed
parent b66c7ca0
No related branches found
No related tags found
No related merge requests found
...@@ -251,7 +251,7 @@ GITLAB_TOFU_IMPLICIT_INIT=${GITLAB_TOFU_IMPLICIT_INIT:-true} ...@@ -251,7 +251,7 @@ GITLAB_TOFU_IMPLICIT_INIT=${GITLAB_TOFU_IMPLICIT_INIT:-true}
# Allows users to continue the actual command in case init failed # Allows users to continue the actual command in case init failed
GITLAB_TOFU_IGNORE_INIT_ERRORS=${GITLAB_TOFU_IGNORE_INIT_ERRORS:-false} 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', # If GITLAB_TOFU_INIT_NO_RECONFIGURE is not set to 'true',
# a `-reconfigure` flag is added to the `terraform init` command. # a `-reconfigure` flag is added to the `terraform init` command.
if [ "$GITLAB_TOFU_INIT_NO_RECONFIGURE" != 'true' ]; then if [ "$GITLAB_TOFU_INIT_NO_RECONFIGURE" != 'true' ]; then
...@@ -278,7 +278,7 @@ if [ $sourced -eq 0 ]; then ...@@ -278,7 +278,7 @@ if [ $sourced -eq 0 ]; then
case "${1}" in case "${1}" in
"apply") "apply")
$GITLAB_TOFU_IMPLICIT_INIT && terraform_init $GITLAB_TOFU_IMPLICIT_INIT && tofu_init
if [ "$GITLAB_TOFU_APPLY_NO_PLAN" = false ]; then if [ "$GITLAB_TOFU_APPLY_NO_PLAN" = false ]; then
tofu "${tf_chdir_opt}" "${@}" -input=false -auto-approve "${GITLAB_TOFU_PLAN_CACHE}" tofu "${tf_chdir_opt}" "${@}" -input=false -auto-approve "${GITLAB_TOFU_PLAN_CACHE}"
else else
...@@ -287,7 +287,7 @@ if [ $sourced -eq 0 ]; then ...@@ -287,7 +287,7 @@ if [ $sourced -eq 0 ]; then
fi fi
;; ;;
"destroy") "destroy")
$GITLAB_TOFU_IMPLICIT_INIT && terraform_init $GITLAB_TOFU_IMPLICIT_INIT && tofu_init
tofu "${tf_chdir_opt}" "${@}" -auto-approve tofu "${tf_chdir_opt}" "${@}" -auto-approve
;; ;;
"fmt") "fmt")
...@@ -296,7 +296,7 @@ if [ $sourced -eq 0 ]; then ...@@ -296,7 +296,7 @@ if [ $sourced -eq 0 ]; then
"init") "init")
# shift argument list „one to the left“ to not call 'terraform init init' # shift argument list „one to the left“ to not call 'terraform init init'
shift shift
terraform_init "${@}" tofu_init "${@}"
;; ;;
"plan") "plan")
plan_args='' plan_args=''
...@@ -304,7 +304,7 @@ if [ $sourced -eq 0 ]; then ...@@ -304,7 +304,7 @@ if [ $sourced -eq 0 ]; then
plan_args='-detailed-exitcode' plan_args='-detailed-exitcode'
fi fi
$GITLAB_TOFU_IMPLICIT_INIT && terraform_init $GITLAB_TOFU_IMPLICIT_INIT && tofu_init
# shellcheck disable=SC2086 # shellcheck disable=SC2086
tofu "${tf_chdir_opt}" "${@}" -input=false -out="${GITLAB_TOFU_PLAN_CACHE}" ${var_file_args} ${plan_args} && ret=$? || ret=$? 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 ...@@ -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}" tofu "${tf_chdir_opt}" show -json "${GITLAB_TOFU_PLAN_CACHE}" | jq -r "${jq_plan}" > "${GITLAB_TOFU_PLAN_JSON}"
;; ;;
"validate") "validate")
$GITLAB_TOFU_IMPLICIT_INIT && terraform_init -backend=false $GITLAB_TOFU_IMPLICIT_INIT && tofu_init -backend=false
# shellcheck disable=SC2086 # shellcheck disable=SC2086
tofu "${tf_chdir_opt}" "${@}" ${var_file_args} tofu "${tf_chdir_opt}" "${@}" ${var_file_args}
;; ;;
"test") "test")
$GITLAB_TOFU_IMPLICIT_INIT && terraform_init -backend=false $GITLAB_TOFU_IMPLICIT_INIT && tofu_init -backend=false
# shellcheck disable=SC2086 # shellcheck disable=SC2086
tofu "${tf_chdir_opt}" "${@}" ${var_file_args} tofu "${tf_chdir_opt}" "${@}" ${var_file_args}
;; ;;
"graph") "graph")
$GITLAB_TOFU_IMPLICIT_INIT && terraform_init $GITLAB_TOFU_IMPLICIT_INIT && tofu_init
# shellcheck disable=SC2086 # shellcheck disable=SC2086
tofu "${tf_chdir_opt}" "${@}" ${var_file_args} tofu "${tf_chdir_opt}" "${@}" ${var_file_args}
;; ;;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment