Created
October 11, 2024 04:45
-
-
Save blofeldthefish/2ec788cdf42dfb21ede9b6a3216d716f to your computer and use it in GitHub Desktop.
Take the rubified output from cfnflip, and turn into a cfndsl definition
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
# Does most of the heavy listing to convert from "rubified" output from cfnflip.com website, in a cfndsl ruby definition | |
# Still a few quirks, which require manual edits. | |
cat ${1} | sed -z -E 's/Resource\("([^"]+)"\)(\s*do\s*)Type\("((AWS::)?([A-Za-z0-9]+)::([A-Za-z0-9]+)"\))/\5_\6(:\1) do/g' | \ | |
sed -E 's/Property\("([A-Za-z0-9_]+)",\s*([\[{]|".*?"|[A-Za-z0-9_]+\s*\([^()]*\))?\s*\)?\s*/\1 \2/' | \ | |
sed -E 's/("([^"]+)")(\s*)=>/\2:/' | \ | |
sed 's/})/}/' | \ | |
sed 's/])/]/' | \ | |
sed 's/"/'"'"'/g' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment