Created
November 22, 2017 21:13
-
-
Save kpettijohn/4887fb2db72caaef21b62ebc981b7686 to your computer and use it in GitHub Desktop.
Terraform IAM Policy diff tool
This file contains hidden or 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
#!/bin/bash | |
cat $1.txt| \ | |
sed -E 's/\\n//g'| \ | |
awk -F "=>" '{print $1}'| \ | |
rev| \ | |
cut -c 1-| \ | |
rev| \ | |
sed 's/[[:blank:]]//g'| \ | |
sed -E 's/\\//g'|sed 's/^"//'| \ | |
jq '.' > old.json | |
cat $1.txt| \ | |
sed -E 's/\\n//g' | \ | |
awk -F "=>" '{print $2}'| \ | |
rev| \ | |
cut -c 1-| \ | |
rev| \ | |
sed 's/[[:blank:]]//g'| \ | |
sed -E 's/\\//g'| \ | |
sed 's/^"//'| \ | |
jq '.' > new.json | |
git diff -U100 --no-index old.json new.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment