diff --git a/src/gitlab-tofu.sh b/src/gitlab-tofu.sh index 439fdb63d6cecd3001ae3245af4d486f92f26dc0..a1dd4cda57051fa6575205868ec9ec57ffadcb80 100644 --- a/src/gitlab-tofu.sh +++ b/src/gitlab-tofu.sh @@ -227,7 +227,7 @@ if [ -z "${TF_CLI_CONFIG_FILE}" ] && [ -f "${default_tf_cli_config_file}" ]; the fi -terraform_authenticate_private_registry() { +tofu_authenticate_private_registry() { # From Terraform 1.2.0 and later (or all versions of OpenTofu), we can use TF_TOKEN_your_domain_name to authenticate to registry. # The credential environment variable has the following requirements: # - Domain names containing non-ASCII characters are converted to their punycode equivalent with an ACE prefix @@ -269,7 +269,7 @@ tofu_init() { # and helper functions exposed by this script. if [ $sourced -eq 0 ]; then # Authenticate to private registry - terraform_authenticate_private_registry + tofu_authenticate_private_registry var_file_args="" if [ -n "${GITLAB_TOFU_VAR_FILE}" ]; then diff --git a/tests/unit/gitlab-tofu.bats b/tests/unit/gitlab-tofu.bats index 44890a0e584cba526150e353a705cf72f5e374bc..ecdd7d3fa63817efd1a86c60620b80a66227826d 100644 --- a/tests/unit/gitlab-tofu.bats +++ b/tests/unit/gitlab-tofu.bats @@ -139,7 +139,7 @@ EOF @test "gitlab-tofu no wrap" { # NOTE: running `gitlab-tofu apply` wouldn't fail - # because of the implicit `terraform init`. + # because of the implicit `tofu init`. run gitlab-tofu -- apply -no-color assert_failure assert_output --partial 'Error: Backend initialization required, please run "tofu init"' @@ -206,7 +206,7 @@ set -x export CI_SERVER_HOST=gitlab.example.com export TF_TOKEN_gitlab_example_com=mysecrettoken . $(which gitlab-tofu) -terraform_authenticate_private_registry +tofu_authenticate_private_registry test "$TF_TOKEN_gitlab_example_com" = "mysecrettoken" EOF @@ -224,7 +224,7 @@ set -x export CI_SERVER_HOST=gitlab.example.com export TF_TOKEN_gitlab_example_com=mysecrettoken . $(which gitlab-tofu) -terraform_authenticate_private_registry +tofu_authenticate_private_registry test "$TF_TOKEN_gitlab_example_com" = "mysecrettoken" EOF