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

Introduce auto-approve with FF

parent 6d1b76c1
No related branches found
No related tags found
No related merge requests found
......@@ -105,6 +105,7 @@ but no destructive actions.
- [`validate-plan`](templates/validate-plan.yml)
- [`validate-plan-apply`](templates/validate-plan-apply.yml)
- [`validate-plan-destroy`](templates/validate-plan-destroy.yml)
### Job Templates
......
......@@ -107,6 +107,7 @@ but no destructive actions.
- [`validate-plan`](templates/validate-plan.yml)
- [`validate-plan-apply`](templates/validate-plan-apply.yml)
- [`validate-plan-destroy`](templates/validate-plan-destroy.yml)
### Job Templates
......
......@@ -16,6 +16,10 @@ if [ -z "$TF_FF_AUTO_URLENCODE_STATE_NAME" ]; then
TF_FF_AUTO_URLENCODE_STATE_NAME=true
fi
if [ -z "$TF_FF_AUTO_APPROVE_APPLY" ]; then
TF_FF_AUTO_APPROVE_APPLY=true
fi
# Helpers
# Evaluate if this script is being sourced or executed directly.
......@@ -165,11 +169,16 @@ if [ $sourced -eq 0 ]; then
case "${1}" in
"apply")
auto_approve_args=""
if [ "${TF_FF_AUTO_APPROVE_APPLY}" = true ]; then
auto_approve_args="-auto-approve"
fi
$TF_IMPLICIT_INIT && terraform_init
if [ "$TF_APPLY_NO_PLAN" = false ]; then
tofu "${TF_CHDIR_OPT}" "${@}" -input=false "${TF_PLAN_CACHE}"
tofu "${TF_CHDIR_OPT}" "${@}" -input=false "${auto_approve_args}" "${TF_PLAN_CACHE}"
else
tofu "${TF_CHDIR_OPT}" "${@}" -input=false
tofu "${TF_CHDIR_OPT}" "${@}" -input=false "${auto_approve_args}"
fi
;;
"destroy")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment