Skip to content

tcudok-jg/terraform-aws-lambda

 
 

Repository files navigation

AWS Lambda

Deploy Lambda into VPC or outside of the vpc

Usage example

Here's the gist of using it via github.

module lambda {
  source = "github.com/terraform-module/terraform-aws-lambda?ref=v2.4.0"

  function_name      = "lambda-to-deploy"
  filename           = "${path.module}/lambda.zip"
  description        = "description should be here"
  handler            = "index.handler"
  runtime            = "nodejs12.x"
  memory_size        = "128"
  concurrency        = "5"
  lambda_timeout     = "20"
  log_retention      = "1"
  role_arn           = "some-role-arn"

  vpc_config = {
    subnet_ids         = ["sb-q53asdfasdfasdf", "sf-3asdfasdfasdf6"]
    security_group_ids = ["sg-3asdfadsfasdfas"]
  }

  environment = {
    Environment = "test"
  }

  tags = {
    Environment = "test"
  }
}

Module Variables

Inputs

Name Description Type Default Required
concurrency The amount of reserved concurrent executions for this lambda function. A value of 0 disables lambda from being triggered and -1 removes any concurrency limitations. number n/a yes
description Description of what your Lambda Function does. string n/a yes
environment The Lambda environment's configuration settings. map(string) "null" no
event_age_in_seconds Maximum age of a request that Lambda sends to a function for processing in seconds. Valid values between 60 and 21600. number "100" no
filename The path to the function's deployment package within the local filesystem. If defined. No S3 support string n/a yes
function_name A unique name for your Lambda Function. string n/a yes
handler The function entrypoint in your code. string n/a yes
lambda_timeout The amount of time your Lambda Function has to run in seconds. Defaults to 5 number "5" no
log_retention Specifies the number of days you want to retain log events in the specified log group. number "1" no
memory_size Amount of memory in MB your Lambda Function can use at runtime. Defaults to 128. number n/a yes
publish Whether to publish creation/change as new Lambda Function Version. Defaults to true. bool "true" no
retry_attempts Maximum number of times to retry when the function returns an error. Valid values between 0 and 2. Defaults to 2. number "0" no
role_arn IAM role attached to the Lambda Function. This governs both who / what can invoke your Lambda Function, as well as what resources our Lambda Function has access to. string n/a yes
runtime See Runtimes for valid values. string n/a yes
tags A mapping of tags to assign to the object. map {} no
tracing_config Use AWS X-Ray to collect data about events that your function processes, and to identify the cause of errors in your serverless applications. Can be either PassThrough or Active. object "null" no
vpc_config Provide this to allow your function to access your VPC. Fields documented below. See Lambda in VPC. object "null" no
source_code_hash Used to trigger updates when file contents change. Must be set to a base64-encoded SHA256 hash of the package file specified with either filename or s3_key. string "null" no

Outputs

Name Description
arn Lambda ARN
cloudwatch_logs_arn
name Lambda Name

Commands

$ make help 
hooks                          Commit hooks setup
validate                       Validate with pre-commit hooks
changelog                      Update changelog
release                        Create release version 

How to Contribute

Submit a pull request

About

Lambda To be deployed into VPC

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • HCL 91.9%
  • Makefile 8.1%