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

Merge branch 'init-var-file' into 'main'

Pass var file to init

Closes #96

See merge request components/opentofu!213
parents a42014c0 b7538d3d
No related branches found
No related tags found
No related merge requests found
......@@ -219,6 +219,10 @@ fi
# Misc variables
var_file="${GITLAB_TOFU_VAR_FILE}"
var_file_args=""
if [ -n "${var_file}" ]; then
var_file_args="--var-file=${var_file}"
fi
# Helper functions
# ================
......@@ -284,8 +288,7 @@ tofu_init() {
fi
# shellcheck disable=SC2086 # We want to allow word splitting here for `init_flags`
tofu "${tf_chdir_opt}" init "${@}" -input=false ${tofu_init_reconfigure_flag} ${init_flags} \
1>&2 || $should_ignore_init_errors
tofu "${tf_chdir_opt}" init "${@}" -input=false ${tofu_init_reconfigure_flag} ${init_flags} ${var_file_args} 1>&2 || $should_ignore_init_errors
}
......@@ -359,11 +362,6 @@ if [ $sourced -eq 0 ]; then
# Authenticate to private registry
tofu_authenticate_private_registry
var_file_args=""
if [ -n "${var_file}" ]; then
var_file_args="--var-file=${var_file}"
fi
case "${1}" in
"apply")
$should_do_implicit_init && tofu_init
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment