Terraform AWS module for AWS Lambda
This module creates an AWS lambda and all the related resources. It is a complete re-write of our internal terraform lambda module.
Checkout examples on how to use this module for various trigger sources.
Module managed by Comtravo .
MIT Licensed. See LICENSE for full details.
Name
Description
Type
Default
Required
cloudwatch_log_retention
Enable Cloudwatch logs retention
number
90
no
cloudwatch_log_subscription
Cloudwatch log stream configuration
object({ enable : bool filter_pattern : string destination_arn : string })
{ "destination_arn": "", "enable": false, "filter_pattern": "" }
no
description
Lambda function description
string
"Managed by Terraform"
no
environment
Lambda environment variables
map(string)
null
no
file_name
Lambda function filename name
string
null
no
function_name
Lambda function name
string
n/a
yes
handler
Lambda function handler
string
null
no
image_config
Container image configuration values that override the values in the container image Dockerfile.
object({ command = list(string) entry_point = list(string) working_directory = string })
null
no
image_uri
ECR image URI containing the function's deployment package
string
null
no
kinesis_configuration
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_event_source_mapping
map(object({ batch_size = number bisect_batch_on_function_error = bool destination_config__on_failure__destination_arn = string event_source_arn = string maximum_batching_window_in_seconds = number maximum_record_age_in_seconds = number maximum_retry_attempts = number parallelization_factor = number starting_position = string starting_position_timestamp = string tumbling_window_in_seconds = number }))
{}
no
layers
List of layers for this lambda function
list(string)
[]
no
memory_size
Lambda function memory size
number
128
no
publish
Publish lambda function
bool
false
no
region
AWS region
string
n/a
yes
reserved_concurrent_executions
Reserved concurrent executions for this lambda function
number
-1
no
role
Lambda function role
string
n/a
yes
runtime
Lambda function runtime
string
"nodejs14.x"
no
s3_bucket
S3 bucket name where lambda package is stored
string
null
no
s3_key
S3 key where lambda package is stored
string
null
no
s3_object_version
S3 object version of the lambda package
string
null
no
sqs_external
External SQS to consume
object({ batch_size = number sqs_arns = list(string) })
null
no
tags
Tags for this lambda function
map(string)
{}
no
timeout
Lambda function runtime
number
300
no
tracing_config
https://www.terraform.io/docs/providers/aws/r/lambda_function.html
object({ mode : string })
{ "mode": "PassThrough" }
no
trigger
Trigger configuration for this lambda function
any
n/a
yes
vpc_config
Lambda VPC configuration
object({ subnet_ids : list(string) security_group_ids : list(string) })
{ "security_group_ids": [], "subnet_ids": [] }
no