-
-
Save KyMidd/f0b4bda7299b8ee0b20478588372ac37 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [[ "$TERRAFORM_PLAN_OUTPUT" =~ "infrastructure matches the configuration" ]]; then | |
echo "There are no changes for terraform to apply." | |
elif [[ "$TERRAFORM_PLAN_OUTPUT" =~ "will perform the following actions" ]]; then | |
echo "Drift has been detected, posting notification to Slack room" | |
# Set vars | |
REPO_URL=${{ github.server_url }}/${{ github.repository }} | |
ACTION_RUN_URL=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
# Send drift detection post to slack | |
curl -sX POST --data-urlencode "payload={\"text\": \"Drift has been detected in <$REPO_URL|${{ github.event.repository.name }}> in env <${ACTION_RUN_URL}|${{ inputs.solution_name }}>.\"}" ${{ inputs.prod_drift_slack_webhook_url }} | |
else | |
echo "There was an error detecting if there were changes" | |
echo "We should investigate what's wrong, or try re-running this workflow" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment