@@ -3,6 +3,11 @@ name: Plan infrastructure changes
33on :
44 workflow_call :
55 inputs :
6+ config :
7+ description : OpenTofu configuration to plan.
8+ default : service
9+ required : true
10+ type : string
611 environment :
712 description : Environment to plan on.
813 default : development
2227 TF_VAR_VPC_PUBLIC_SUBNET_CIDRS :
2328 workflow_dispatch :
2429 inputs :
30+ config :
31+ description : OpenTofu configuration to plan.
32+ default : service
33+ required : true
34+ type : choice
35+ options :
36+ - foundation
37+ - networking
38+ - service
2539 environment :
2640 description : Environment to plan on.
2741 default : development
@@ -32,9 +46,6 @@ permissions:
3246 contents : read
3347 id-token : write
3448
35- env :
36- CONFIG_PATH : ./tofu/config/development
37-
3849jobs :
3950 plan :
4051 name : Plan changes to ${{ inputs.environment || 'development' }}
@@ -77,19 +88,19 @@ jobs:
7788 fi
7889 done
7990 - name : Initialize OpenTofu
80- working-directory : ${{ env.CONFIG_PATH }}
91+ working-directory : ./tofu/config/ ${{ inputs.config }}
8192 run : tofu init
8293 - name : Plan changes
83- working-directory : ${{ env.CONFIG_PATH }}
94+ working-directory : ./tofu/config/ ${{ inputs.config }}
8495 run : tofu plan -concise -no-color -out tfplan > plan.txt
8596 - name : Display plan
86- working-directory : ${{ env.CONFIG_PATH }}
97+ working-directory : ./tofu/config/ ${{ inputs.config }}
8798 run : tofu show -plan tfplan
8899 - name : Upload plan file
89100 uses : actions/upload-artifact@v4
90101 with :
91102 name : tfplan
92103 path : |
93- ${{ env.CONFIG_PATH }}/plan.txt
94- ${{ env.CONFIG_PATH }}/tfplan
104+ ./tofu/config/ ${{ inputs.config }}/plan.txt
105+ ./tofu/config/ ${{ inputs.config }}/tfplan
95106 retention-days : 5
0 commit comments