diff --git a/templates/plan.yml b/templates/plan.yml
index 81e3229a544d903849d652dab2ca63fc52545d67..7f18e99d342ff657aa0a23c402255dcb91be99f3 100644
--- a/templates/plan.yml
+++ b/templates/plan.yml
@@ -110,7 +110,15 @@ spec:
   extends: null
 
 '.$[[ inputs.as ]]:detailed_exitcode:warning:true':
+  variables:
+    OPENTOFU_COMPONENT_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`.
+    FF_USE_NEW_BASH_EVAL_STRATEGY: 'true'
   allow_failure:
+    # NOTE: tofu plan -detailed-exitcode return 2 as exit code
+    # when the plan is non-empty.
     exit_codes: [2]
 
 '$[[ inputs.as ]]':
@@ -145,11 +153,6 @@ spec:
     TF_STATE_NAME: $[[ inputs.state_name ]]
     TF_PLAN_NAME: $[[ inputs.plan_name ]]
     OPENTOFU_COMPONENT_VAR_FILE: '$[[ inputs.var_file ]]'
-    OPENTOFU_COMPONENT_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`.
-    FF_USE_NEW_BASH_EVAL_STRATEGY: 'true'
   image:
     name: '$[[ inputs.image_registry_base ]]/$[[ inputs.image_name ]]:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]-$[[ inputs.base_os ]]$[[ inputs.image_digest ]]'
   script: