From 447fe033f61a3858ffdeb3087ccf8c05ab41118d Mon Sep 17 00:00:00 2001 From: Timo Furrer <tfurrer@gitlab.com> Date: Wed, 13 Nov 2024 15:21:30 +0100 Subject: [PATCH] Rename `TF_INIT_NO_RECONFIGURE` to `GITLAB_TOFU_INIT_NO_RECONFIGURE` Changelog: changed --- src/gitlab-tofu.sh | 5 +++-- tests/unit/gitlab-tofu.bats | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gitlab-tofu.sh b/src/gitlab-tofu.sh index 660ede8..a82737f 100644 --- a/src/gitlab-tofu.sh +++ b/src/gitlab-tofu.sh @@ -19,6 +19,7 @@ # GITLAB_TOFU_PLAN_JSON: if set is the full path of the plan json file. Defaults to `<root>/$GITLAB_TOFU_PLAN_NAME.json` # GITLAB_TOFU_IMPLICIT_INIT: if set to true will perform an implicit `tofu init` before any command that require it. Defaults to `true`. # GITLAB_TOFU_IGNORE_INIT_ERRORS: if set to true will ignore errors in the `tofu init` command. +# GITLAB_TOFU_INIT_NO_RECONFIGURE: if set to true will not pass `-reconfigure` to the `tofu init` command. # # Respected OpenTofu Environment Variables: # > these are variables that are @@ -213,9 +214,9 @@ GITLAB_TOFU_IMPLICIT_INIT=${GITLAB_TOFU_IMPLICIT_INIT:-true} GITLAB_TOFU_IGNORE_INIT_ERRORS=${GITLAB_TOFU_IGNORE_INIT_ERRORS:-false} terraform_init() { - # If TF_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. - if [ "$TF_INIT_NO_RECONFIGURE" != 'true' ]; then + if [ "$GITLAB_TOFU_INIT_NO_RECONFIGURE" != 'true' ]; then tf_init_reconfigure_flag='-reconfigure' fi diff --git a/tests/unit/gitlab-tofu.bats b/tests/unit/gitlab-tofu.bats index 75e34d2..bdf1c38 100644 --- a/tests/unit/gitlab-tofu.bats +++ b/tests/unit/gitlab-tofu.bats @@ -59,7 +59,7 @@ teardown() { } EOF - export TF_INIT_NO_RECONFIGURE="true" + export GITLAB_TOFU_INIT_NO_RECONFIGURE="true" run ! gitlab-tofu init -no-color assert_output --partial "Error: Backend configuration changed" } -- GitLab