Skip to content

Commit

Permalink
Fix root directory for doing hash (must do .. from terraform root.dir)
Browse files Browse the repository at this point in the history
  • Loading branch information
danscales committed Sep 29, 2024
1 parent c1dea6c commit 8a40fac
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
2 changes: 1 addition & 1 deletion terraform/data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,6 @@ data "template_file" "step_function_policy" {
}

data "external" "hash" {
program = [coalesce(var.hash_script, "${path.module}/scripts/hash.sh"), var.root_dir, var.docker_path]
program = [coalesce(var.hash_script, "${path.module}/scripts/hash.sh"), "${var.root_dir}/../", var.docker_path]
}

4 changes: 0 additions & 4 deletions terraform/scripts/hash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ if [ -f "$IGNORE" ]; then
a=$(printf "! -regex ^./%s.* " `< .dockerignore`)
b=${a//\/.//\\\.}

# Show files that hash depends on in stderr
find . -type f $b >&2
file_hashes="$(
find . -type f $b -exec md5sum {} \;
)"
Expand All @@ -48,6 +46,4 @@ fi
popd

hash="$(echo "$file_hashes" | md5sum | cut -d' ' -f1)"
# Echo has on stderr.
echo "Hash: " $hash >&2
echo '{ "hash": "'"$hash"'" }'

0 comments on commit 8a40fac

Please sign in to comment.