Skip to content

Commit 098aeb7

Browse files
chore: add fetch_lambda_from_s3 flag
1 parent 9784c07 commit 098aeb7

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

main.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,13 @@ data "aws_s3_object" "fpjs_integration_s3_bucket" {
100100

101101
resource "aws_lambda_function" "fpjs_proxy_lambda" {
102102
description = "Fingerprint Proxy Lambda@Edge function"
103-
s3_bucket = var.local_lambda_path == null ? data.aws_s3_object.fpjs_integration_s3_bucket.bucket : null
104-
s3_key = var.local_lambda_path == null ? data.aws_s3_object.fpjs_integration_s3_bucket.key : null
105-
filename = var.local_lambda_path != null ? var.local_lambda_path : null
103+
s3_bucket = var.fetch_lambda_from_s3 ? data.aws_s3_object.fpjs_integration_s3_bucket.bucket : null
104+
s3_key = var.fetch_lambda_from_s3 ? data.aws_s3_object.fpjs_integration_s3_bucket.key : null
105+
filename = !var.fetch_lambda_from_s3 ? var.local_lambda_path : null
106106
function_name = "fingerprint-pro-cloudfront-lambda-${local.integration_id}"
107107
role = aws_iam_role.fpjs_proxy_lambda.arn
108108
handler = "fingerprintjs-pro-cloudfront-lambda-function.handler"
109-
source_code_hash = var.local_lambda_path == null ? data.aws_s3_object.fpjs_integration_s3_bucket.etag : filemd5(var.local_lambda_path)
109+
source_code_hash = var.fetch_lambda_from_s3 ? data.aws_s3_object.fpjs_integration_s3_bucket.etag : filemd5(var.local_lambda_path)
110110
memory_size = 128
111111
timeout = 10
112112

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,9 @@ variable "local_lambda_path" {
4040
default = null
4141
description = "Path to locally built lambda function that should be used for deployment, instead of the lambda stored in S3 bucket. Should be in zip format."
4242
}
43+
44+
variable "fetch_lambda_from_s3" {
45+
type = bool
46+
default = true
47+
description = "Whether to fetch lambda code from Fingerprint S3 bucket. Should be set to `false` if `local_lambda_path` is used."
48+
}

0 commit comments

Comments
 (0)