Skip to content

Commit 71170c5

Browse files
committed
add data.archive_file so the checksums are present at plan stage
1 parent 277c969 commit 71170c5

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

modules/oidc/callback.tf

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
# Callback Lambda
2+
data "archive_file" "callback_lambda_zip" {
3+
count = local.enabled ? 1 : 0
4+
type = "zip"
5+
source_file = "${path.module}/lambda/callback/index.js"
6+
output_path = "${path.module}/lambda/callback.zip"
7+
}
8+
29
resource "archive_file" "callback_lambda_zip" {
310
count = local.enabled ? 1 : 0
411
type = "zip"
@@ -12,8 +19,8 @@ resource "aws_lambda_function" "oidc_callback" {
1219
role = aws_iam_role.lambda_oidc[0].arn
1320
handler = "index.handler"
1421
runtime = "nodejs22.x"
15-
filename = resource.archive_file.callback_lambda_zip[0].output_path
16-
source_code_hash = resource.archive_file.callback_lambda_zip[0].output_base64sha256
22+
filename = data.archive_file.callback_lambda_zip[0].output_path
23+
source_code_hash = data.archive_file.callback_lambda_zip[0].output_base64sha256
1724
publish = true
1825

1926
environment {

modules/oidc/edge.tf

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
11
# Edge Lambda
2+
data "archive_file" "edge_lambda_zip" {
3+
count = local.enabled ? 1 : 0
4+
type = "zip"
5+
output_path = "${path.module}/lambda/edge_auth.zip"
6+
7+
source {
8+
filename = "index.js"
9+
content = file("${path.module}/lambda/edge_auth/index.js")
10+
}
11+
12+
source {
13+
filename = "config.json"
14+
content = local.oidc_config_json
15+
}
16+
}
17+
218
resource "archive_file" "edge_lambda_zip" {
319
count = local.enabled ? 1 : 0
420
type = "zip"
@@ -22,8 +38,8 @@ resource "aws_lambda_function" "edge_auth" {
2238
role = aws_iam_role.lambda_oidc[0].arn
2339
handler = "index.handler"
2440
runtime = "nodejs22.x"
25-
filename = resource.archive_file.edge_lambda_zip[0].output_path
26-
source_code_hash = resource.archive_file.edge_lambda_zip[0].output_base64sha256
41+
filename = data.archive_file.edge_lambda_zip[0].output_path
42+
source_code_hash = data.archive_file.edge_lambda_zip[0].output_base64sha256
2743
publish = true
2844

2945
tags = var.tags

0 commit comments

Comments
 (0)