Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ RUN \

# Lambda and SASL_SSL_Artifacts
COPY $SASL_SSL_ARTIFACTS /opt/sasl_ssl_artifacts/
COPY src/ $LAMBDA_TASK_ROOT/
COPY src $LAMBDA_TASK_ROOT/src
COPY conf $LAMBDA_TASK_ROOT/conf

# Mark librdkafka to LD_LIBRARY_PATH
Expand All @@ -81,4 +81,4 @@ ENV \
KRB5CCNAME=FILE:/tmp/krb5cc

# Set lambda entry point as CMD
CMD ["event_gate_lambda.lambda_handler"]
CMD ["src.event_gate_lambda.lambda_handler"]
44 changes: 25 additions & 19 deletions terraform/lambda.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
resource "aws_security_group" "event_gate_sg" {
name = "${var.resource_prefix}event-gate-sg"
name = "${var.resource_prefix}event-gate-sg"
description = "SG for Event Gate"
vpc_id = var.vpc_id
tags = {"BuiltBy" = "Terraform"}
vpc_id = var.vpc_id
tags = { "BuiltBy" = "Terraform" }
}

resource "aws_vpc_security_group_egress_rule" "allow_all_traffic_ipv4" {
security_group_id = aws_security_group.event_gate_sg.id
cidr_ipv4 = "0.0.0.0/0"
ip_protocol = "-1"
cidr_ipv4 = "0.0.0.0/0"
ip_protocol = "-1"
}

data "aws_s3_object" "event_gate_lambda_zip" {
Expand All @@ -19,27 +19,33 @@ data "aws_s3_object" "event_gate_lambda_zip" {

resource "aws_lambda_function" "event_gate_lambda" {
function_name = "${var.resource_prefix}event-gate-lambda"
role = var.lambda_role_arn
role = var.lambda_role_arn
architectures = ["x86_64"]
timeout = 60
runtime = "python3.13"
timeout = 60

package_type = var.lambda_package_type
s3_bucket = var.lambda_package_type == "Zip" ? var.lambda_src_s3_bucket : null
s3_key = var.lambda_package_type == "Zip" ? var.lambda_src_s3_key : null
handler = var.lambda_package_type == "Zip" ? "event_gate_lambda.lambda_handler" : null
s3_bucket = var.lambda_package_type == "Zip" ? var.lambda_src_s3_bucket : null
s3_key = var.lambda_package_type == "Zip" ? var.lambda_src_s3_key : null
handler = var.lambda_package_type == "Zip" ? "event_gate_lambda.lambda_handler" : null
runtime = var.lambda_package_type == "Zip" ? "python3.13" : null

image_config {
command = var.lambda_package_type == "Image" ? ["src.event_gate_lambda.lambda_handler"] : null
}

source_code_hash = var.lambda_package_type == "Zip" ? data.aws_s3_object.event_gate_lambda_zip[0].etag : null

image_uri = var.lambda_package_type == "Image" ? var.lambda_src_ecr_image : null

vpc_config {
subnet_ids = var.lambda_vpc_subnet_ids
subnet_ids = var.lambda_vpc_subnet_ids
security_group_ids = [aws_security_group.event_gate_sg.id]
}
tags = {"BuiltBy" = "Terraform"}
tags = { "BuiltBy" = "Terraform" }

environment {
variables = {
LOG_LEVEL = "INFO"
}
variables = {
LOG_LEVEL = "INFO"
}
}
}