File tree Expand file tree Collapse file tree 1 file changed +25
-3
lines changed
Expand file tree Collapse file tree 1 file changed +25
-3
lines changed Original file line number Diff line number Diff line change 1818 type : string
1919 default : us-east-1
2020 description : ' AWS region of terraform deployment.'
21-
21+ var_file :
22+ required : false
23+ default : " "
24+ type : string
25+ description : ' Terraform var file directory. e.g. vars/dev.tfvars'
26+ secrets :
27+ AZURE_CREDENTIALS :
28+ required : false
29+ description : ' Azure Credentials to install Azure in github runner.'
30+ aws_access_key_id :
31+ required : false
32+ description : ' AWS Access Key ID to install AWS CLI.'
33+ aws_secret_access_key :
34+ required : false
35+ description : ' AWS Secret access key to install AWS CLI'
36+ GITHUB :
37+ required : true
38+ description : ' PAT of the user to run the jobs.'
2239jobs :
2340 terraform-plan :
2441 name : ' Terraform Plan'
7794 run : |
7895 export exitcode=0
7996 cd ${{ inputs.working_directory }}
97+ if [ -n "${{ inputs.var_file }}" ]; then
98+ terraform plan -detailed-exitcode -no-color -out tfplan --var-file=${{ inputs.var_file }} || export exitcode=$?
99+ else
80100 terraform plan -detailed-exitcode -no-color -out tfplan || export exitcode=$?
81-
101+ fi
102+
82103 echo "exitcode=$exitcode" >> $GITHUB_OUTPUT
83104
84105 if [ $exitcode -eq 1 ]; then
@@ -173,7 +194,7 @@ jobs:
173194 if : steps.tf-plan.outputs.exitcode == 0
174195 uses : actions/github-script@v6
175196 with :
176- github-token : ${{ secrets.GITHUB_TOKEN }}
197+ github-token : ${{ secrets.GITHUB }}
177198 script : |
178199 const title = 'Terraform Configuration Drift Detected';
179200 const creator = 'github-actions[bot]'
@@ -202,3 +223,4 @@ jobs:
202223 - name : Error on Failure
203224 if : steps.tf-plan.outputs.exitcode == 2
204225 run : exit 1
226+
You can’t perform that action at this time.
0 commit comments