Skip to content
Snippets Groups Projects
Commit 9cc000fb authored by Timo Furrer's avatar Timo Furrer
Browse files

Merge branch 'var-names' into 'main'

Rename internal `OPENTOFU_COMPONENT_` variables to `GITLAB_TOFU_`

See merge request components/opentofu!185
parents 6085bd9b 70a67d25
No related branches found
No related tags found
No related merge requests found
...@@ -207,8 +207,8 @@ if [ $sourced -eq 0 ]; then ...@@ -207,8 +207,8 @@ if [ $sourced -eq 0 ]; then
terraform_authenticate_private_registry terraform_authenticate_private_registry
var_file_args="" var_file_args=""
if [ -n "${OPENTOFU_COMPONENT_VAR_FILE}" ]; then if [ -n "${GITLAB_TOFU_VAR_FILE}" ]; then
var_file_args="--var-file=${OPENTOFU_COMPONENT_VAR_FILE}" var_file_args="--var-file=${GITLAB_TOFU_VAR_FILE}"
fi fi
case "${1}" in case "${1}" in
...@@ -240,7 +240,7 @@ if [ $sourced -eq 0 ]; then ...@@ -240,7 +240,7 @@ if [ $sourced -eq 0 ]; then
;; ;;
"plan") "plan")
plan_args='' plan_args=''
if [ "${OPENTOFU_COMPONENT_USE_DETAILED_EXITCODE}" = 'true' ]; then if [ "${GITLAB_TOFU_USE_DETAILED_EXITCODE}" = 'true' ]; then
plan_args='-detailed-exitcode' plan_args='-detailed-exitcode'
fi fi
...@@ -248,7 +248,7 @@ if [ $sourced -eq 0 ]; then ...@@ -248,7 +248,7 @@ if [ $sourced -eq 0 ]; then
# shellcheck disable=SC2086 # shellcheck disable=SC2086
tofu "${TF_CHDIR_OPT}" "${@}" -input=false -out="${TF_PLAN_CACHE}" ${var_file_args} ${plan_args} && ret=$? || ret=$? 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 [ "$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 if ! tofu "${TF_CHDIR_OPT}" show -json "${TF_PLAN_CACHE}" | jq -r "${JQ_PLAN}" > "${TF_PLAN_JSON}"; then
exit $? exit $?
......
...@@ -113,7 +113,7 @@ spec: ...@@ -113,7 +113,7 @@ spec:
TF_STATE_NAME: $[[ inputs.state_name ]] TF_STATE_NAME: $[[ inputs.state_name ]]
TF_APPLY_NO_PLAN: $[[ inputs.no_plan ]] TF_APPLY_NO_PLAN: $[[ inputs.no_plan ]]
TF_PLAN_NAME: $[[ inputs.plan_name ]] TF_PLAN_NAME: $[[ inputs.plan_name ]]
OPENTOFU_COMPONENT_VAR_FILE: '$[[ inputs.var_file ]]' GITLAB_TOFU_VAR_FILE: '$[[ inputs.var_file ]]'
image: image:
name: '$[[ inputs.image_registry_base ]]/$[[ inputs.image_name ]]:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]-$[[ inputs.base_os ]]$[[ inputs.image_digest ]]' name: '$[[ inputs.image_registry_base ]]/$[[ inputs.image_name ]]:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]-$[[ inputs.base_os ]]$[[ inputs.image_digest ]]'
script: script:
......
...@@ -113,7 +113,7 @@ spec: ...@@ -113,7 +113,7 @@ spec:
TF_STATE_NAME: $[[ inputs.state_name ]] TF_STATE_NAME: $[[ inputs.state_name ]]
TF_APPLY_NO_PLAN: $[[ inputs.no_plan ]] TF_APPLY_NO_PLAN: $[[ inputs.no_plan ]]
TF_PLAN_NAME: $[[ inputs.plan_name ]] TF_PLAN_NAME: $[[ inputs.plan_name ]]
OPENTOFU_COMPONENT_VAR_FILE: '$[[ inputs.var_file ]]' GITLAB_TOFU_VAR_FILE: '$[[ inputs.var_file ]]'
image: image:
name: '$[[ inputs.image_registry_base ]]/$[[ inputs.image_name ]]:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]-$[[ inputs.base_os ]]$[[ inputs.image_digest ]]' name: '$[[ inputs.image_registry_base ]]/$[[ inputs.image_name ]]:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]-$[[ inputs.base_os ]]$[[ inputs.image_digest ]]'
script: script:
......
...@@ -105,7 +105,7 @@ spec: ...@@ -105,7 +105,7 @@ spec:
__CACHE_KEY_HACK: "$[[ inputs.root_dir ]]" __CACHE_KEY_HACK: "$[[ inputs.root_dir ]]"
TF_ROOT: $[[ inputs.root_dir ]] TF_ROOT: $[[ inputs.root_dir ]]
TF_STATE_NAME: $[[ inputs.state_name ]] TF_STATE_NAME: $[[ inputs.state_name ]]
OPENTOFU_COMPONENT_VAR_FILE: '$[[ inputs.var_file ]]' GITLAB_TOFU_VAR_FILE: '$[[ inputs.var_file ]]'
image: image:
name: '$[[ inputs.image_registry_base ]]/$[[ inputs.image_name ]]:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]-$[[ inputs.base_os ]]$[[ inputs.image_digest ]]' name: '$[[ inputs.image_registry_base ]]/$[[ inputs.image_name ]]:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]-$[[ inputs.base_os ]]$[[ inputs.image_digest ]]'
script: script:
......
...@@ -112,7 +112,7 @@ spec: ...@@ -112,7 +112,7 @@ spec:
'.$[[ inputs.as ]]:detailed_exitcode:warning:true': '.$[[ inputs.as ]]:detailed_exitcode:warning:true':
variables: 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 # 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 # behavior. However, when using bash the runner does not work properly without setting
# the feature flag below to `true`. # the feature flag below to `true`.
...@@ -158,8 +158,8 @@ spec: ...@@ -158,8 +158,8 @@ spec:
TF_ROOT: $[[ inputs.root_dir ]] TF_ROOT: $[[ inputs.root_dir ]]
TF_STATE_NAME: $[[ inputs.state_name ]] TF_STATE_NAME: $[[ inputs.state_name ]]
TF_PLAN_NAME: $[[ inputs.plan_name ]] TF_PLAN_NAME: $[[ inputs.plan_name ]]
OPENTOFU_COMPONENT_PLAN_WITH_JSON: true GITLAB_TOFU_PLAN_WITH_JSON: true
OPENTOFU_COMPONENT_VAR_FILE: '$[[ inputs.var_file ]]' GITLAB_TOFU_VAR_FILE: '$[[ inputs.var_file ]]'
image: image:
name: '$[[ inputs.image_registry_base ]]/$[[ inputs.image_name ]]:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]-$[[ inputs.base_os ]]$[[ inputs.image_digest ]]' name: '$[[ inputs.image_registry_base ]]/$[[ inputs.image_name ]]:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]-$[[ inputs.base_os ]]$[[ inputs.image_digest ]]'
script: script:
......
...@@ -108,7 +108,7 @@ spec: ...@@ -108,7 +108,7 @@ spec:
__CACHE_KEY_HACK: "$[[ inputs.root_dir ]]" __CACHE_KEY_HACK: "$[[ inputs.root_dir ]]"
TF_ROOT: $[[ inputs.root_dir ]] TF_ROOT: $[[ inputs.root_dir ]]
TF_STATE_NAME: $[[ inputs.state_name ]] TF_STATE_NAME: $[[ inputs.state_name ]]
OPENTOFU_COMPONENT_VAR_FILE: '$[[ inputs.var_file ]]' GITLAB_TOFU_VAR_FILE: '$[[ inputs.var_file ]]'
image: image:
name: '$[[ inputs.image_registry_base ]]/$[[ inputs.image_name ]]:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]-$[[ inputs.base_os ]]$[[ inputs.image_digest ]]' name: '$[[ inputs.image_registry_base ]]/$[[ inputs.image_name ]]:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]-$[[ inputs.base_os ]]$[[ inputs.image_digest ]]'
script: script:
......
...@@ -105,7 +105,7 @@ spec: ...@@ -105,7 +105,7 @@ spec:
TF_ROOT: $[[ inputs.root_dir ]] TF_ROOT: $[[ inputs.root_dir ]]
TF_STATE_NAME: $[[ inputs.state_name ]] TF_STATE_NAME: $[[ inputs.state_name ]]
TF_IGNORE_INIT_ERRORS: 'true' # Tofu can report errors which might be the reason init failed. 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: image:
name: '$[[ inputs.image_registry_base ]]/$[[ inputs.image_name ]]:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]-$[[ inputs.base_os ]]$[[ inputs.image_digest ]]' name: '$[[ inputs.image_registry_base ]]/$[[ inputs.image_name ]]:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]-$[[ inputs.base_os ]]$[[ inputs.image_digest ]]'
script: script:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment