Skip to content

Commit ddf91f4

Browse files
Merge pull request #44 from fingerprintjs/INTER-1219/extend-module
Add support for locally built Lambda function
2 parents 9b12565 + 9863aaa commit ddf91f4

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

.github/workflows/trivy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
jobs:
1111
build:
1212
name: Scan
13-
runs-on: ubuntu-20.04
13+
runs-on: ubuntu-22.04
1414
steps:
1515
- name: Checkout code
1616
uses: actions/checkout@v4

main.tf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +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 = data.aws_s3_object.fpjs_integration_s3_bucket.bucket
104-
s3_key = data.aws_s3_object.fpjs_integration_s3_bucket.key
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
105106
function_name = "fingerprint-pro-cloudfront-lambda-${local.integration_id}"
106107
role = aws_iam_role.fpjs_proxy_lambda.arn
107108
handler = "fingerprintjs-pro-cloudfront-lambda-function.handler"
108-
source_code_hash = data.aws_s3_object.fpjs_integration_s3_bucket.etag
109+
source_code_hash = var.fetch_lambda_from_s3 ? data.aws_s3_object.fpjs_integration_s3_bucket.etag : filemd5(var.local_lambda_path)
109110
memory_size = 128
110111
timeout = 10
111112

variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,15 @@ variable "fpjs_proxy_lambda_role_permissions_boundary_arn" {
3434
description = "Permissions boundary ARN for the role assumed by the Proxy lambda. Make sure your permissions boundary allows the function to access the Secrets Manager secret created for the integration (`secretsmanager:GetSecretValue`) and create logs (`logs:CreateLogStream`, `logs:CreateLogGroup`, `logs:PutLogEvents`)."
3535
default = null
3636
}
37+
38+
variable "local_lambda_path" {
39+
type = string
40+
default = null
41+
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."
42+
}
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)