diff --git a/src/gitlab-tofu.sh b/src/gitlab-tofu.sh index 660ede8ef35f8ed16459909e73c18cd967d7acbf..a82737f49d4172acfc95512028d5829e38c74973 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 75e34d2ddcf639abd6726e982a4f3abceb891bdf..bdf1c3863430b5bccef22baa6331528efd6be2e8 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" }