Created
July 8, 2021 18:34
-
-
Save isaiahtaylor/7242200adaa6fef53c1c2e25a900f384 to your computer and use it in GitHub Desktop.
Hash a directory for Terraform external data source
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
#!/usr/bin/env bash | |
set -e | |
eval "$(jq -r '@sh "DIRECTORY=\(.directory)"')" | |
HASH=$(git ls-files --exclude-standard -os ${DIRECTORY} | git hash-object --stdin) | |
echo "{\"checksum\": \"${HASH}\"}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment