queue-driven-lambda

bmd/queue-driven-lambda/aws

Terraform Module HCL AWS

Easily create SQS-fed Lambda functions

Install
module "queue-driven-lambda" {
source = "bmd/queue-driven-lambda/aws"
version = "0.2.4"
}
plain text: /constructs/tfmod-bmd-queue-driven-lambda-aws/install.txt
⭐ Source on GitHub 📦 Registry page
README

Queue-Fed Lambda Terraform Module This module abstracts the newly-supported pattern of triggering a Lambda function directly from an SQS queue, and handles provisioning the Lambda, queue, a dead-letter queue to hold failed messages, and a Cloudwatch log group for the Lambda's invocation and function logs. The high level architecture of this module is easy to visualize: !Architecture You can read more about the design principles in and use-cases AWS's introduction to the pattern. Quickstart ``terraform module "q_lambda" { source "bmd/queue-driven-lambda/aws" project_prefix = "qfl-test" filename = "example.zip" function_name = "my_lambda_fn" handler = "index.handle" runtime = "go1.x" lambda_iam_role = aws_iam_role.test_iam.arn event_batch_size = 1 } ` A complete example of the minimal code r

Inputs (18)
NameTypeDescriptionDefault
lambda_iam_rolestringIAM role attached to the Lambda Function. This governs both who / what can invok required
filenamestringThe path to the function's deployment package within the local filesystem. For m required
runtimestringSee https://docs.aws.amazon.com/lambda/latest/dg/API_CreateFunction.html#SSS-Cre required
function_namestringA unique name for your Lambda Function. This will also be used as a prefix for n required
handlerstringThe function entrypoint in your code. required
max_receive_countnumberThe number of times a message should be replayed before it's sent to the deadlet5
timeoutnumber The amount of time your Lambda Function has to run in seconds. Defaults to 3.3
message_retention_secondsnumberThe number of seconds Amazon SQS retains a message. Integer representing seconds345600
reserved_concurrent_executionsstringThe amount of reserved concurrent executions for this lambda function. A value o"-1"
max_message_sizenumberThe limit of how many bytes a message can contain before Amazon SQS rejects it. 262144
log_retention_in_daysnumberThe number of days to retain the Lambda's CloudWatch execution logs for. The def14
memory_sizenumberAmount of memory in MB your Lambda Function can use at runtime. Defaults to 128.128
descriptionstringDescription of what your Lambda Function does. ""
publishboolWhether to publish creation/change as new Lambda Function Version. Defaults to ffalse
event_source_enabledboolWhether the event mapping between the SQS Queue and Lambda should be enabled on true
event_batch_sizenumberThe largest number of records that Lambda will retrieve from the SQS queue at th10
dlq_message_retention_secondsnumberThe message retention settings for the Deadletter Queue. See the description for345600
environmentmap(map(string))The Lambda environment's configuration settings. See the official module's docum{}
Outputs (5)
task_queue_id — The URL of the task queue
task_queue_arn — The ARN of the task queue
deadletter_queue_id — The URL of the deadletter queue (if created)
deadletter_queue_arn — The ARN of the deadletter queue (if created)
log_stream_arn — The ARN if the Lambda's Cloudwatch Logs stream (if created)
Resources (4)
aws_cloudwatch_log_groupaws_lambda_event_source_mappingaws_lambda_functionaws_sqs_queue
Details
FrameworkTerraform Module
LanguageHCL
Version0.2.4
Cloud AWS
★ Stars0
Forks2
Total downloads6.5k
Inputs18
Outputs5
Resources4
Examples2
LicenseMIT
Namespacebmd
Updated