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
10 changes: 10 additions & 0 deletions platform/production/us-east-1/000/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
create_package = true
create = true
handler = "app.lambda_handler"
cors = { allow_origins = ["*"] }
source_path = "../../../../../../../src/function/"
name = "platform_sample-useast1-production-000-fn-000"
environment_variables = {
PAYLOAD = "Primary"
}

7 changes: 7 additions & 0 deletions platform/production/us-east-1/000/terragrunt.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
include "root" {
path = find_in_parent_folders()
}

terraform {
source = "git::https://github.com/launchbynttdata/tf-aws-module_primitive-lambda_function//.?ref=1.0.3"
}
5 changes: 4 additions & 1 deletion platform/production/us-east-2/000/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ create = true
handler = "app.lambda_handler"
cors = { allow_origins = ["*"] }
source_path = "../../../../../../../src/function/"
name = "platform-sample-lambda-function"
name = "platform_sample-useast2-production-000-fn-000"
environment_variables = {
PAYLOAD = "Failover"
}
5 changes: 4 additions & 1 deletion platform/sandbox/us-east-2/000/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ create = true
handler = "app.lambda_handler"
cors = { allow_origins = ["*"] }
source_path = "../../../../../../../src/function/"
name = "platform-sample-lambda-function"
name = "platform_sample-useast2-sandbox-000-fn-000"
environment_variables = {
PAYLOAD = "Primary-East"
}
7 changes: 5 additions & 2 deletions platform/sandbox/us-east-2/001/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
create_package = true
create = true
handler = "app.alternate_lambda_handler"
handler = "app.lambda_handler"
cors = { allow_origins = ["*"] }
source_path = "../../../../../../../src/function/"
name = "platform-sample-lambda-function-2"
name = "platform_sample-useast2-sandbox-001-fn-000"
environment_variables = {
PAYLOAD = "Failover-East"
}
9 changes: 9 additions & 0 deletions platform/sandbox/us-west-2/000/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
create_package = true
create = true
handler = "app.lambda_handler"
cors = { allow_origins = ["*"] }
source_path = "../../../../../../../src/function/"
name = "platform_sample-uswest2-sandbox-000-fn-000"
environment_variables = {
PAYLOAD = "Primary-West"
}
7 changes: 7 additions & 0 deletions platform/sandbox/us-west-2/000/terragrunt.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
include "root" {
path = find_in_parent_folders()
}

terraform {
source = "git::https://github.com/launchbynttdata/tf-aws-module_primitive-lambda_function//.?ref=1.0.3"
}
9 changes: 9 additions & 0 deletions platform/sandbox/us-west-2/001/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
create_package = true
create = true
handler = "app.lambda_handler"
cors = { allow_origins = ["*"] }
source_path = "../../../../../../../src/function/"
name = "platform_sample-uswest2-sandbox-001-fn-000"
environment_variables = {
PAYLOAD = "Failover-West"
}
7 changes: 7 additions & 0 deletions platform/sandbox/us-west-2/001/terragrunt.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
include "root" {
path = find_in_parent_folders()
}

terraform {
source = "git::https://github.com/launchbynttdata/tf-aws-module_primitive-lambda_function//.?ref=1.0.3"
}
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dependencies = []
dev = [
"pytest>=8.4.0",
"pytest-cov>=6.2.1",
"pytest-mock>=3.14.1",
"ruff>=0.11.13",
]

Expand Down Expand Up @@ -52,4 +53,4 @@ exclude = [
"node_modules",
"site-packages",
".venv",
]
]
12 changes: 8 additions & 4 deletions src/function/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
def lambda_handler(event, context):
return {"statusCode": 200, "body": "Hello from a sample Python Lambda!"}
import os

PAYLOAD = os.environ.get("PAYLOAD")


def alternate_lambda_handler(event, context):
return {"statusCode": 200, "body": "Hello from a different sample Python Lambda!"}
def lambda_handler(event, context):
return {
"statusCode": 200,
"body": f"Hello from a sample Python Lambda! Payload: {PAYLOAD}",
}
15 changes: 10 additions & 5 deletions test/unit/test_app.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
from unittest.mock import patch

from function import app


def test_primary_handler():
result = app.lambda_handler(None, None)
assert result["statusCode"] == 200
assert result["body"] == "Hello from a sample Python Lambda!"
assert result["body"] == "Hello from a sample Python Lambda! Payload: None"


def test_alternate_handler():
result = app.alternate_lambda_handler(None, None)
assert result["statusCode"] == 200
assert result["body"] == "Hello from a different sample Python Lambda!"
def test_primary_handler_with_payload():
with patch.object(app, "PAYLOAD", "test_payload"):
result = app.lambda_handler(None, None)
assert result["statusCode"] == 200
assert (
result["body"] == "Hello from a sample Python Lambda! Payload: test_payload"
)
14 changes: 14 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading