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

Rename internal `OPENTOFU_COMPONENT_` variables to `GITLAB_TOFU_`

Changelog: development
parent 8d8c0d7d
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@
# set some shell options
set -o errexit
if [ "${DEBUG_OUTPUT}" = "true" ]; then
set -o xtrace
fi
......@@ -205,8 +205,8 @@ if [ $sourced -eq 0 ]; then
terraform_authenticate_private_registry
var_file_args=""
if [ -n "${OPENTOFU_COMPONENT_VAR_FILE}" ]; then
var_file_args="--var-file=${OPENTOFU_COMPONENT_VAR_FILE}"
if [ -n "${GITLAB_TOFU_VAR_FILE}" ]; then
var_file_args="--var-file=${GITLAB_TOFU_VAR_FILE}"
fi
case "${1}" in
......@@ -238,7 +238,7 @@ if [ $sourced -eq 0 ]; then
;;
"plan")
plan_args=''
if [ "${OPENTOFU_COMPONENT_USE_DETAILED_EXITCODE}" = 'true' ]; then
if [ "${GITLAB_TOFU_USE_DETAILED_EXITCODE}" = 'true' ]; then
plan_args='-detailed-exitcode'
fi
......@@ -246,7 +246,7 @@ if [ $sourced -eq 0 ]; then
# shellcheck disable=SC2086
tofu "${TF_CHDIR_OPT}" "${@}" -input=false -out="${TF_PLAN_CACHE}" ${var_file_args} ${plan_args} && ret=$? || ret=$?
if [ "${OPENTOFU_COMPONENT_PLAN_WITH_JSON}" = 'true' ]; then
if [ "${GITLAB_TOFU_PLAN_WITH_JSON}" = 'true' ]; then
if [ "$ret" -eq 0 ] || [ "$ret" -eq 2 ]; then
if ! tofu "${TF_CHDIR_OPT}" show -json "${TF_PLAN_CACHE}" | jq -r "${JQ_PLAN}" > "${TF_PLAN_JSON}"; then
exit $?
......
......@@ -113,7 +113,7 @@ spec:
TF_STATE_NAME: $[[ inputs.state_name ]]
TF_APPLY_NO_PLAN: $[[ inputs.no_plan ]]
TF_PLAN_NAME: $[[ inputs.plan_name ]]
OPENTOFU_COMPONENT_VAR_FILE: '$[[ inputs.var_file ]]'
GITLAB_TOFU_VAR_FILE: '$[[ inputs.var_file ]]'
image:
name: '$[[ inputs.image_registry_base ]]/$[[ inputs.image_name ]]:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]-$[[ inputs.base_os ]]$[[ inputs.image_digest ]]'
script:
......
......@@ -113,7 +113,7 @@ spec:
TF_STATE_NAME: $[[ inputs.state_name ]]
TF_APPLY_NO_PLAN: $[[ inputs.no_plan ]]
TF_PLAN_NAME: $[[ inputs.plan_name ]]
OPENTOFU_COMPONENT_VAR_FILE: '$[[ inputs.var_file ]]'
GITLAB_TOFU_VAR_FILE: '$[[ inputs.var_file ]]'
image:
name: '$[[ inputs.image_registry_base ]]/$[[ inputs.image_name ]]:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]-$[[ inputs.base_os ]]$[[ inputs.image_digest ]]'
script:
......
......@@ -105,7 +105,7 @@ spec:
__CACHE_KEY_HACK: "$[[ inputs.root_dir ]]"
TF_ROOT: $[[ inputs.root_dir ]]
TF_STATE_NAME: $[[ inputs.state_name ]]
OPENTOFU_COMPONENT_VAR_FILE: '$[[ inputs.var_file ]]'
GITLAB_TOFU_VAR_FILE: '$[[ inputs.var_file ]]'
image:
name: '$[[ inputs.image_registry_base ]]/$[[ inputs.image_name ]]:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]-$[[ inputs.base_os ]]$[[ inputs.image_digest ]]'
script:
......
......@@ -112,7 +112,7 @@ spec:
'.$[[ inputs.as ]]:detailed_exitcode:warning:true':
variables:
OPENTOFU_COMPONENT_USE_DETAILED_EXITCODE: '$[[ inputs.warning_on_non_empty_plan ]]'
GITLAB_TOFU_USE_DETAILED_EXITCODE: '$[[ inputs.warning_on_non_empty_plan ]]'
# NOTE: we rely on correct exitcode reporting behavior for the `warning_on_non_empty_plan` input
# behavior. However, when using bash the runner does not work properly without setting
# the feature flag below to `true`.
......@@ -158,8 +158,8 @@ spec:
TF_ROOT: $[[ inputs.root_dir ]]
TF_STATE_NAME: $[[ inputs.state_name ]]
TF_PLAN_NAME: $[[ inputs.plan_name ]]
OPENTOFU_COMPONENT_PLAN_WITH_JSON: true
OPENTOFU_COMPONENT_VAR_FILE: '$[[ inputs.var_file ]]'
GITLAB_TOFU_PLAN_WITH_JSON: true
GITLAB_TOFU_VAR_FILE: '$[[ inputs.var_file ]]'
image:
name: '$[[ inputs.image_registry_base ]]/$[[ inputs.image_name ]]:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]-$[[ inputs.base_os ]]$[[ inputs.image_digest ]]'
script:
......
......@@ -108,7 +108,7 @@ spec:
__CACHE_KEY_HACK: "$[[ inputs.root_dir ]]"
TF_ROOT: $[[ inputs.root_dir ]]
TF_STATE_NAME: $[[ inputs.state_name ]]
OPENTOFU_COMPONENT_VAR_FILE: '$[[ inputs.var_file ]]'
GITLAB_TOFU_VAR_FILE: '$[[ inputs.var_file ]]'
image:
name: '$[[ inputs.image_registry_base ]]/$[[ inputs.image_name ]]:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]-$[[ inputs.base_os ]]$[[ inputs.image_digest ]]'
script:
......
......@@ -105,7 +105,7 @@ spec:
TF_ROOT: $[[ inputs.root_dir ]]
TF_STATE_NAME: $[[ inputs.state_name ]]
TF_IGNORE_INIT_ERRORS: 'true' # Tofu can report errors which might be the reason init failed.
OPENTOFU_COMPONENT_VAR_FILE: '$[[ inputs.var_file ]]'
GITLAB_TOFU_VAR_FILE: '$[[ inputs.var_file ]]'
image:
name: '$[[ inputs.image_registry_base ]]/$[[ inputs.image_name ]]:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]-$[[ inputs.base_os ]]$[[ inputs.image_digest ]]'
script:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment