Event Processor

module "event_processor" {
  source  = "registry.patterneddesigns.ca/patterneddesigns/lambda-function/aws"
  version = "3.1.0"

  function_name = "event-processor"
  runtime       = "python3.12"
  handler       = "main.handler"
  source_path   = "./src"

  memory_size = 1024
  timeout     = 60

  # Limit concurrent executions to protect downstream services
  reserved_concurrent_executions = 50

  environment_variables = {
    BATCH_SIZE    = "100"
    MAX_RETRIES   = "3"
  }
}

# SQS trigger
resource "aws_lambda_event_source_mapping" "sqs" {
  event_source_arn = aws_sqs_queue.events.arn
  function_name    = module.event_processor.function_arn
  batch_size       = 10
}