This repository has been archived by the owner on Jan 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Better CloudFormation validation output in tests
- Loading branch information
1 parent
cfdec67
commit f5cd2c5
Showing
1 changed file
with
6 additions
and
4 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
#!/bin/bash | ||
ERROR_COUNT=0; | ||
|
||
echo "Validating AWS CloudFormation templates..." | ||
|
||
# Loop through the YAML templates in this repository | ||
for TEMPLATE in $(find . -name '*.yaml'); do | ||
|
||
# Validate the template with CloudFormation | ||
ERRORS=$(aws cloudformation validate-template --template-body file://$TEMPLATE 2>&1 >/dev/null); | ||
|
||
if [ "$?" -gt "0" ]; then | ||
|
||
((ERROR_COUNT++)); | ||
echo "$TEMPLATE: $ERRORS"; | ||
echo "[fail] $TEMPLATE: $ERRORS"; | ||
else | ||
echo "[pass] $TEMPLATE"; | ||
fi; | ||
|
||
done; | ||
|
||
echo "$ERROR_COUNT template validation error(s)"; | ||
if [ "$ERROR_COUNT" -gt 0 ]; | ||
then exit 1; | ||
fi | ||
fi |