Skip to content

About

Creates a Lambda function.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

38 Commits

Folders and files

Repository files navigation


Need help with your Cloud builds GET IN TOUCH.


Lambda function

Upon launching the following resources will be created:

  • Lambda function
  • Default CW log group: OPTIONAL

Dependencies and Prerequisites

  • Terraform v1.0.0 or higher
  • AWS account

Providers

Name Version
aws >= 5.0.0

Modules

No modules.

Resources

Name Type
aws_cloudwatch_log_group.loggroup resource
aws_lambda_function.function resource

Inputs

Name Description Type Default Required
create_default_log_group OPTIONAL: Whether to create default log group. Set to 1 to create number 1 no
environment_vars Map of environment variables map(string) null no
ephemeral_storage The amount of Ephemeral storage(/tmp) to allocate for the Lambda Function in MB. number "512" no
function Lambda function variables - merged will locals to create configuration map(any) null no
locals_function n/a
object({
filename = string
name = string
role = string
handler = string
runtime = string
timeout = number
memory_size = number
reserved_concurrent_executions = number
source_code_hash = string
publish = bool
package_type = string
})
{
"filename": null,
"handler": null,
"memory_size": 128,
"name": null,
"package_type": "Zip",
"publish": true,
"reserved_concurrent_executions": -1,
"role": null,
"runtime": "java11",
"source_code_hash": null,
"timeout": 60
}
no
locals_s3 n/a
object({
bucket = string
key = string
object_version = string
})
{
"bucket": null,
"key": null,
"object_version": null
}
no
region n/a string "eu-west-1" no
retention_in_days Log retention in dayes number 7 no
s3 OPTIONAL: s3 object to specify function location in s3 - merged with locals to create configuration map(any) null no
security_group_ids OPTIONAL: The VPC security groups to assign to the Lambda. list(string) [] no
subnet_ids OPTIONAL: The VPC subnets in which the Lambda runs. list(string) [] no
tags Tags to assign to the Function map(string) {} no
tracing_config Tracing config. Can be either PassThrough or Active string "Active" no

Outputs

Name Description
lambda_function n/a

Usage

To import the module add the following to your TF file:

module "lambda" {
  source  = "Cloud-42/lambda/aws"
  version = "3.1.0"  # Or required version
  function = ({
    name        = var.function_name
    role        = var.function_role
    handler     = var.handler
    filename    = "./lambda.zip"
    runtime     = "python3.9"
    memory_size = "512"
    timeout     = "600"
  })

  ephemeral_storage = "10240"

  s3 = ({
    bucket = "my-s3-source-bucket"
    key    = "file.jar.zip"
  })

  environment_vars = {
    ENV_VAR = "${var.ENV_VAR}"
  }
}
  • To initialise the module run: terraform init
  • To update the module run : terraform get --update
  • To see a plan of changes : terraform plan
  • To apply : terraform apply
  • To automatically apply : terraform apply --auto-approve

About

Creates a Lambda function.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages