This will return the full Git commit SHA of whichever branch is currently checkedout.
Dump the snippet into terraform console (run from within a Git repo) to see for yourself.
| trimspace(file(".git/${trimspace(trimprefix(file(".git/HEAD"), "ref:"))}")) |