Last active
March 28, 2019 17:56
-
-
Save jayers99/ab1db900e6a5c3dd1abf9ced3745ccd1 to your computer and use it in GitHub Desktop.
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
# -i case insensitive | |
# -l just show file path | |
# -r recursive | |
# -n line number | |
searchTerm="" | |
# just list the files containing search term | |
egrep -irl --include \*.tf --exclude-dir=.* "$searchTerm" | |
# to see the search term | |
egrep -irn --include \*.tf --exclude-dir=.* "$searchTerm" | |
# start of some terraform linting | |
# look for hard coded regions | |
searchTerm="\s+=" | |
egrep -irn --include \*.tf --exclude-dir=.* "$searchTerm" | |
# list all the arn referances | |
grep -ir --no-filename --include \*.tf --exclude-dir=.terraform --exclude-dir=.git -Poh '\"arn:aws:iam::.+:role.+\"' | sort | uniq -c | sort -rn | |
# get distribution of aws provider versions | |
grep -irP --no-filename --include \*.tf --exclude-dir=.terraform --exclude-dir=.git '\bversion\s*=' | sed 's/^\s*//g' | sort | uniq -c | sort -rn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment