-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5a6bf5f
commit 653377f
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
# Set working directory | ||
ROOT_DIR="$(pwd)" | ||
SCHEMA_URL="https://schema.cloudformation.us-east-1.amazonaws.com/CloudformationSchema.zip" | ||
FILEPATH="${ROOT_DIR}/CloudformationSchema.zip" | ||
|
||
# Function to cleanup on exit | ||
cleanup() { | ||
rm -f "${FILEPATH}" | ||
} | ||
|
||
# Error handling | ||
set -e | ||
trap cleanup EXIT | ||
|
||
# Remove existing JSON files | ||
rm -f ./*.json | ||
|
||
# Download schema | ||
echo "Downloading schema..." | ||
curl -L -o "${FILEPATH}" "${SCHEMA_URL}" || { | ||
echo "Failed to download schema" | ||
exit 1 | ||
} | ||
|
||
# Extract zip file | ||
echo "Extracting schema..." | ||
unzip -o "${FILEPATH}" || { | ||
echo "Failed to extract schema" | ||
exit 1 | ||
} |