Skip to content

yaleman/terraform_lambda

Repository files navigation

Terraform-Lambda

Quick module for spinning up a terraform and scheduling it to run periodically.

Due to limitations I couldn't figure out how to fix, if you don't set an environment variable it'll set a default one of "supersecretenvironmentvariable" = "thisisadefaultsetting".

Variables

Name Type Description Notes
function_name string what it'll be called in AWS
lambda_handler string
lambda_runtime string Python3.8 or whatever you want to run it in
aws_region string
aws_profile string
lambda_run_on_schedule bool Enable the schedule runner Defaults to false
lambda_schedule_expression string When to run it via EventBridge https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html
lambda_timeout number The maximum runtime in seconds
lambda_memory number The configured memory (in megabytes) the function's allowed to use
layer_arns list(string) A list of layer ARNs to include
lambda_script_filename string The original filename on the filesystem of the function
lambda_script_additional_files list(string) Additional files to include in the package.
environment_variables map(string) A map of environment variables By default, it'll set "supersecretenvironmentvariable" = "thisisadefaultsetting"
log_retention_days string Number of days to keep the function logs defaults to 1

Changelog

  • 1.0.4 - Compatibility with Terraform 0.13+
  • 1.0.6 - AWS provider >5.10
  • 1.0.9 - Removing provider block

Terraform Documentation

Requirements

Name Version
terraform >= 0.13
aws ~> 5.10

Providers

Name Version
archive 2.4.1
aws 5.31.0

Modules

No modules.

Resources

Name Type
aws_cloudwatch_event_rule.schedule_lambda_execution resource
aws_cloudwatch_event_target.schedule_lambda_execution resource
aws_cloudwatch_log_group.log_group resource
aws_iam_role.lambda_role resource
aws_iam_role_policy_attachment.lambda_basic_execution_role resource
aws_lambda_function.this resource
aws_lambda_permission.allow_cloudwatch_to_run_lambdas resource
archive_file.lambda data source

Inputs

Name Description Type Default Required
aws_profile The profile we will use to build and implement this string n/a yes
aws_region The region that all these things are built in string n/a yes
environment_variables Environment block map(string) {} no
function_name Name of the function once it's uploaded string n/a yes
lambda_handler Function name in the script that the lambda will run - feeds aws_lambda_function.this.handler string "lambda_handler" no
lambda_memory Allocated memory for function number 128 no
lambda_run_on_schedule Set this to false if you don't want to schedule it bool false no
lambda_runtime Runtime that the lambda runs in string "python3.8" no
lambda_schedule_expression How often to run the lambda string "" no
lambda_script_additional_files Additional script files to add to the package list(string) [] no
lambda_script_filename Source filename of the lambda to upload string n/a yes
lambda_timeout Maximum runtime in seconds of your lambda number 30 no
layer_arns List of ARNs of layers to include in the function runtime list(string) [] no
log_retention_days Number of days to keep the logs in cloudwatch string 1 no

Outputs

Name Description
lambda_function_name n/a
role_arn n/a
role_name n/a

About

A module for terraform-ing up an AWS Lambda Function

Resources

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors