Skip to content

Commit

Permalink
Ensure package hash is stable
Browse files Browse the repository at this point in the history
Fastly added metadata collection[^1] to the CLI in version 10.6.0. The
metadata includes the heap size during the build, which is not stable
over time. Because of that, Terraform always detected a change to the
compute package, even though no code had changed.

Disabling the metadata collection ensures that the package hash is
stable between builds, thus reducing the noise in Terraform.

[^1]: https://developer.fastly.com/learning/tools/cli/#metadata-collection
  • Loading branch information
jdno committed Feb 6, 2024
1 parent e081d07 commit 0858d1d
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ script_path=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
project_path=$(cd "${script_path}" && cd ".." && pwd)
project_name="${project_path##*/}"

cd "${project_path}" && fastly compute build &>/dev/null
cd "${project_path}" && fastly compute build --metadata-disable &>/dev/null

# Return a valid JSON object that Terraform can consume
echo "{\"path\": \"./${project_name}/pkg/compute-static.tar.gz\"}"

0 comments on commit 0858d1d

Please sign in to comment.