diff --git a/.github/workflows/infra_apply.yaml b/.github/workflows/infra_apply.yaml index dbb379fe..9d135235 100644 --- a/.github/workflows/infra_apply.yaml +++ b/.github/workflows/infra_apply.yaml @@ -154,7 +154,7 @@ jobs: calculate_hash() { local module_path="$1" - tar --exclude=.* -cvf - "$module_path" | sha256sum | awk '{ print $1 }' + find "$module_path" -type f -not -path "$module_path/.*" | sort | xargs sha256sum | awk '{print $1}' | sha256sum | awk '{print $1}' } # Iterate over modules listed in the metadata that were sourced from the Terraform registry diff --git a/.github/workflows/infra_plan.yaml b/.github/workflows/infra_plan.yaml index 439678b0..5df8eb90 100644 --- a/.github/workflows/infra_plan.yaml +++ b/.github/workflows/infra_plan.yaml @@ -157,7 +157,7 @@ jobs: calculate_hash() { local module_path="$1" - tar --exclude="$module_path/.*" -cf - "$module_path" | sha256sum | awk '{ print $1 }' + find "$module_path" -type f -not -path "$module_path/.*" | sort | xargs sha256sum | awk '{print $1}' | sha256sum | awk '{print $1}' } # Iterate over modules listed in the metadata that were sourced from the Terraform registry diff --git a/infra/resources/dev/tfmodules.lock.json b/infra/resources/dev/tfmodules.lock.json index f4c7e98a..adbe9f12 100644 --- a/infra/resources/dev/tfmodules.lock.json +++ b/infra/resources/dev/tfmodules.lock.json @@ -1,3 +1,4 @@ { - "dx-azure-naming-conventionz": "302662f449f4359dc31a92ac3be39b3cb6311efe769c45d21149b40ab2453aa5" + "dx-azure-naming-convention": "807e8fafaf3cda8d1df7cc5c624715555ff150e87a8df0becc7e5cab3e54f855", + "dx-azure-naming-conventionz": "b0f4e012251e566e638cba00f25d3e9e79e7ba67058e89d6f1a6b11062e203cb" } diff --git a/infra/scripts/lock-modules.sh b/infra/scripts/lock-modules.sh index 656f3056..d1811ac9 100755 --- a/infra/scripts/lock-modules.sh +++ b/infra/scripts/lock-modules.sh @@ -112,7 +112,8 @@ function ensure_terraform_get() { function calculate_hash() { local -r module_path="$1" # Create tar archive excluding hidden files, then calculate SHA256 hash - tar --exclude='$module_path/.*' -cf - "$module_path" | sha256sum | awk '{ print $1 }' + # tar --exclude='$module_path/.*' -cf - "$module_path" | sha256sum | awk '{ print $1 }' + find "$module_path" -type f -not -path "$module_path/.*" | sort | xargs sha256sum | awk '{print $1}' | sha256sum | awk '{print $1}' } # Initialize or create the hashes file if it doesn't exist