Skip to content

Commit df98cfc

Browse files
committed
shared locals
1 parent 3333c66 commit df98cfc

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

terraform/id_sync_lambda.tf

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
# Define the directory containing the Docker image and calculate its SHA-256 hash for triggering redeployments
22
locals {
3-
id_sync_lambda_dir = abspath("${path.root}/../redis_sync")
3+
lambdas_dir = abspath("${path.root}/../lambdas")
4+
shared_dir = abspath("${path.root}/../lambdas/shared")
5+
id_sync_lambda_dir = abspath("${path.root}/../lambdas/id_sync")
6+
7+
# Get files from both directories
8+
shared_files = fileset(local.shared_dir, "**")
49
id_sync_lambda_files = fileset(local.id_sync_lambda_dir, "**")
10+
11+
# Calculate SHA for both directories
12+
shared_dir_sha = sha1(join("", [for f in local.shared_files : filesha1("${local.shared_dir}/${f}")]))
513
id_sync_lambda_dir_sha = sha1(join("", [for f in local.id_sync_lambda_files : filesha1("${local.id_sync_lambda_dir}/${f}")]))
14+
15+
# Combined SHA to trigger rebuild when either directory changes
16+
combined_sha = sha1("${local.shared_dir_sha}${local.id_sync_lambda_dir_sha}")
617
}
718

819
resource "aws_ecr_repository" "id_sync_lambda_repository" {

0 commit comments

Comments
 (0)