Ever done a load of refactoring on some terraform code and wonder what variables are still required? This command gives you a sorted list of all occurences of the pattern "var.something":
ack -h 'var\.[\w]+' | perl -ne 'print "$1\n" while /var\.(\w+)/g' | sort -u
Updated 2017-11-30: match multiple variables on the same line