variable "enabled" { type = bool default = true description = "Whether to create the Lambda function" } variable "region" { type = string description = "AWS region" } variable "namespace" { type = string default = "ai" description = "Namespace for resource naming" } variable "lab" { type = string description = "Lab identifier" } variable "stage" { type = string default = "test" description = "Stage" } variable "name" { type = string default = "processor" description = "Function name suffix" } variable "function_name" { type = string default = null description = "Override full function name (optional)" } variable "description" { type = string default = "AI document processor for hands-on labs" description = "Function description" } variable "role_arn" { type = string default = null description = "IAM role ARN for the Lambda function. When null, the component creates a basic execution role with CloudWatch Logs permissions only. For full AI-service permissions wire to the iam-role component output via !terraform.output." } variable "handler" { type = string default = "index.handler" description = "Function handler. Default matches the bundled src/index.py - override if you ship your own zip." } variable "runtime" { type = string default = "python3.12" description = "Lambda runtime" validation { condition = can(regex("^python3\\.(9|10|11|12|13)$", var.runtime)) error_message = "runtime must be one of: python3.9, python3.10, python3.11, python3.12, python3.13." } } variable "timeout" { type = number default = 300 description = "Function timeout in seconds" validation { condition = var.timeout >= 1 && var.timeout <= 900 error_message = "timeout must be between 1 and 900 seconds (Lambda max)." } } variable "memory_size" { type = number default = 512 description = "Function memory in MB" validation { condition = var.memory_size >= 128 && var.memory_size <= 10240 error_message = "memory_size must be between 128 and 10240 MB (Lambda limits)." } } # Code source - either filename OR S3 variable "filename" { type = string default = null description = "Path to the deployment package" } variable "s3_bucket" { type = string default = null description = "S3 bucket containing the deployment package" } variable "s3_key" { type = string default = null description = "S3 key of the deployment package" } variable "source_code_hash" { type = string default = null description = "Optional base64-encoded SHA-256 of the deployment package. Set this when deploying via s3_bucket/s3_key so Terraform detects content changes (otherwise Terraform has nothing to compare). Ignored for filename and auto-zip paths - those compute the hash from the file directly." } variable "environment_variables" { type = map(string) default = {} description = "Environment variables for the function" } variable "output_bucket" { type = string default = null description = "Output S3 bucket name. When null (default), the handler writes outputs to the same bucket that triggered the event." } variable "log_level" { type = string default = "INFO" description = "Log level for the function" } variable "log_retention_days" { type = number default = 7 description = "CloudWatch log retention in days" validation { condition = contains( [0, 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, 2192, 2557, 2922, 3288, 3653], var.log_retention_days, ) error_message = "log_retention_days must be one of the CloudWatch-allowed values (0/1/3/5/7/14/30/60/90/120/150/180/365/400/545/731/1827/2192/2557/2922/3288/3653). Use 0 for never-expire." } } # S3 trigger configuration variable "s3_trigger_enabled" { type = bool default = false description = "Enable S3 trigger" } variable "s3_trigger_bucket_arn" { type = string default = null description = "S3 bucket ARN for trigger" } variable "s3_trigger_bucket_id" { type = string default = null description = "S3 bucket ID for notification configuration" } variable "s3_trigger_events" { type = list(string) default = ["s3:ObjectCreated:*"] description = "S3 events to trigger the function" } variable "s3_trigger_prefix" { type = string default = "input/" description = "S3 key prefix filter" } variable "s3_trigger_suffix" { type = string default = "" description = "S3 key suffix filter" } # Schedule trigger variable "schedule_expression" { type = string default = null description = "EventBridge schedule expression (e.g., rate(1 hour))" } variable "tags" { type = map(string) default = {} description = "Additional tags" }