fix(ci): update terraform job template
This commit is contained in:
@@ -14,16 +14,11 @@ on:
|
||||
ssh-known-hosts:
|
||||
required: true
|
||||
type: string
|
||||
outputs:
|
||||
tfplanexitcode:
|
||||
value: ${{ jobs.tf-plan.outputs.tfplanexitcode }}
|
||||
|
||||
jobs:
|
||||
tf-plan:
|
||||
name: Terraform Plan
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
tfplanexitcode: ${{ steps.tfplan.outputs.exitcode }}
|
||||
|
||||
steps:
|
||||
- uses: hashicorp/setup-terraform@v2
|
||||
@@ -73,17 +68,21 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
terraform plan -detailed-exitcode -out=tfplan.binary -input=false;
|
||||
printf "$?" > exitcode;
|
||||
continue-on-error: true
|
||||
- name: Check if job errored
|
||||
if: ${{ steps.tfplan.outputs.exitcode == 1 }}
|
||||
shell: sh
|
||||
run: exit 1
|
||||
- name: Upload terraform plan if diffs are detected
|
||||
if: ${{ steps.tfplan.outputs.exitcode == 2 }}
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: tfplan
|
||||
path: tfplan.binary
|
||||
name: artifacts
|
||||
path: |
|
||||
tfplan.binary
|
||||
exitcode
|
||||
- name: Check if job errored
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "$(cat exitcode)" == "1" ]; then
|
||||
exit 1;
|
||||
fi
|
||||
- name: Save terraform cache
|
||||
uses: actions/cache/save@v3
|
||||
id: cache-terraform-save
|
||||
|
||||
Reference in New Issue
Block a user