Skip to content

Commit

Permalink
make sure Terraform E2E test fails on detected changes
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrHeinz committed Jul 2, 2024
1 parent b16a9ab commit 65af83d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,12 @@ jobs:
BETTERUPTIME_API_TOKEN: ${{ secrets.UPTIME_E2E_TEAM_TOKEN }}
- name: Plan resources via Terraform - must be empty
run: |
make terraform CONFIGURATION="${{ matrix.config }}" ARGS="plan --detailed-exitcode --input=false"
if [ $? -eq 2 ]; then
echo "Terraform plan has changes, exiting with error."
make terraform CONFIGURATION="${{ matrix.config }}" ARGS="plan --input=false --out=tfplan"
CHANGES="$(terraform -chdir="examples/advanced" show --json tfplan | jq '.resource_changes | length')"
if [ "$CHANGES" == "0" ]; then
echo "No planned changes detected after first apply. Success!"
else
echo "$CHANGES planned changes detected after first apply. Failure!"
exit 1
fi
env:
Expand Down

0 comments on commit 65af83d

Please sign in to comment.