@@ -56,53 +56,29 @@ jobs:
5656
5757 - name : Compute and print inputs + derived toggles
5858 env :
59- # raw inputs (workflow_dispatch boolean inputs)
60- input_use_environment_init : ${{ inputs.use_environment_init }}
61- input_do_init : ${{ inputs.do_init }}
62- input_use_environment_plan : ${{ inputs.use_environment_plan }}
63- input_do_plan : ${{ inputs.do_plan }}
64- input_use_environment_apply : ${{ inputs.use_environment_apply }}
65- input_do_apply : ${{ inputs.do_apply }}
66- input_use_environment_destroy : ${{ inputs.use_environment_destroy }}
67- input_do_destroy : ${{ inputs.do_destroy }}
68-
69- # Derived run toggles (what your reusable workflow expects)
70- # run on push OR when corresponding input is true
71- run_init : ${{ github.event_name == 'push' || inputs.do_init }}
72- run_plan : ${{ github.event_name == 'push' || inputs.do_plan }}
73- run_apply : ${{ github.event_name == 'push' || inputs.do_apply }}
74- run_destroy : ${{ github.event_name == 'workflow_dispatch' && inputs.do_destroy }}
75-
76- # Derived environment-approval toggles: push should force approval for apply
77- use_env_init : ${{ github.event_name == 'workflow_dispatch' && inputs.use_environment_init }}
78- use_env_plan : ${{ github.event_name == 'workflow_dispatch' && inputs.use_environment_plan }}
79- use_env_apply : ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.use_environment_apply) }}
80- use_env_destroy : ${{ github.event_name == 'workflow_dispatch' && inputs.use_environment_destroy }}
81- run : |
82- echo "---- Raw inputs (workflow_dispatch) ----"
83- echo "use_environment_init: $input_use_environment_init"
84- echo "do_init: $input_do_init"
85- echo "use_environment_plan: $input_use_environment_plan"
86- echo "do_plan: $input_do_plan"
87- echo "use_environment_apply: $input_use_environment_apply"
88- echo "do_apply: $input_do_apply"
89- echo "use_environment_destroy: $input_use_environment_destroy"
90- echo "do_destroy: $input_do_destroy"
91- echo ""
59+ # inputs provided by the caller workflow (workflow_call inputs)
60+ input_runInit : ${{ inputs.runInit }}
61+ input_runPlan : ${{ inputs.runPlan }}
62+ input_runApply : ${{ inputs.runApply }}
63+ input_runDestroy : ${{ inputs.runDestroy }}
9264
93- echo "---- Derived run toggles (will be passed to reusable workflow) ----"
94- echo "runInit: $run_init"
95- echo "runPlan: $run_plan"
96- echo "runApply: $run_apply"
97- echo "runDestroy: $run_destroy"
98- echo ""
65+ input_useEnvironmentInit : ${{ inputs.useEnvironmentInit }}
66+ input_useEnvironmentPlan : ${{ inputs.useEnvironmentPlan }}
67+ input_useEnvironmentApply : ${{ inputs.useEnvironmentApply }}
68+ input_useEnvironmentDestroy : ${{ inputs.useEnvironmentDestroy }}
9969
100- echo "---- Derived environment (approval) toggles ----"
101- echo "useEnvironmentInit: $use_env_init"
102- echo "useEnvironmentPlan: $use_env_plan"
103- echo "useEnvironmentApply: $use_env_apply"
104- echo "useEnvironmentDestroy: $use_env_destroy"
70+ run : |
71+ echo "---- Actual inputs received (workflow_call inputs) ----"
72+ echo "runInit: $input_runInit"
73+ echo "runPlan: $input_runPlan"
74+ echo "runApply: $input_runApply"
75+ echo "runDestroy: $input_runDestroy"
10576 echo ""
77+ echo "---- Environment approval inputs (caller-controlled) ----"
78+ echo "useEnvironmentInit: $input_useEnvironmentInit"
79+ echo "useEnvironmentPlan: $input_useEnvironmentPlan"
80+ echo "useEnvironmentApply: $input_useEnvironmentApply"
81+ echo "useEnvironmentDestroy: $input_useEnvironmentDestroy"
10682
10783 echo "---- Note ----"
10884 echo "If any job has 'environment: <non-empty>' that job will request approval from that environment's protection rules."
@@ -161,12 +137,12 @@ jobs:
161137 ARM_CLIENT_ID : ${{ secrets.AZURE_CLIENT_ID }}
162138 ARM_TENANT_ID : ${{ secrets.AZURE_TENANT_ID }}
163139 ARM_SUBSCRIPTION_ID : ${{ secrets.AZURE_SUBSCRIPTION_ID }}
164- run : terraform plan -var-file="../environments/prod .tfvars" -out="tf-plan-${{ inputs.environment }}.tfplan"
140+ run : terraform plan -var-file="../environments/${{ inputs.environment }} .tfvars" -out="tf-plan-${{ inputs.environment }}.tfplan"
165141 # Yha tak wala block...
166142
167143 # Use below mentioned with , when in provider.tf > provider "azurerm" > use_oidc = false (ya fir yeh line humne use hi nhi ki ho)
168144 # - name: Terraform Plan
169- # run: terraform plan -var-file="../environments/prod.tfvars " -out="tf-plan-${{ inputs.environment }}.tfplan"
145+ # run: terraform plan -var-file="../environments/${{ inputs.environment }} " -out="tf-plan-${{ inputs.environment }}.tfplan"
170146 # Yha tak wala block...
171147
172148 - name : Upload plan
0 commit comments