Use this URL for the source of the module. See the usage examples below for more details.
github.com/pbs/terraform-aws-lambda-cron-module?ref=0.1.43
More information can be found on these install methods and more in the documentation here.
Lambda function that is triggered by a CloudWatch Event Rule based on a cron expression.
Integrate this module like so:
module "lambda-cron" {
source = "github.com/pbs/terraform-aws-lambda-cron-module?ref=0.1.43"
# Required Parameters
handler = "main"
filename = "../artifacts/handler.zip"
runtime = "go1.x"
# Tagging Parameters
organization = var.organization
environment = var.environment
product = var.product
repo = var.repo
# Optional Parameters
cron = "05 20 * * ? *"
}
If this repo is added as a subtree, then the version of the module should be close to the version shown here:
0.1.43
Note, however that subtrees can be altered as desired within repositories.
Further documentation on usage can be found here.
Below is automatically generated documentation on this Terraform module using terraform-docs
Name | Version |
---|---|
terraform | >= 1.3.2 |
aws | >= 4.5.0 |
Name | Version |
---|---|
aws | 5.35.0 |
Name | Source | Version |
---|---|---|
lambda | github.com/pbs/terraform-aws-lambda-module | 1.3.40 |
Name | Type |
---|---|
aws_cloudwatch_event_rule.event_rule | resource |
aws_cloudwatch_event_target.event_target | resource |
aws_lambda_permission.allow_event_invocation | resource |
aws_default_tags.common_tags | data source |
Name | Description | Type | Default | Required |
---|---|---|---|---|
environment | Environment (sharedtools, dev, staging, qa, prod) | string |
n/a | yes |
filename | Filename for the artifact to use for the Lambda | string |
n/a | yes |
handler | Cloudwatch event pattern | string |
n/a | yes |
organization | Organization using this module. Used to prefix tags so that they are easily identified as being from your organization | string |
n/a | yes |
product | Tag used to group resources according to product | string |
n/a | yes |
repo | Tag used to point to the repo using this module | string |
n/a | yes |
runtime | Runtime for the lambda function | string |
n/a | yes |
add_app_config_extension_layer | Add the AWS-AppConfig-Lambda-Extension layer to the Lambda function. Ignored if layers is not null or if image_uri is defined. |
bool |
true |
no |
add_ssm_extension_layer | Add the AWS-Parameters-and-Secrets-Lambda-Extension layer to the Lambda function. Ignored if layers is not null or if image_uri is defined. |
bool |
true |
no |
add_vpc_config | Add VPC configuration to the Lambda function | bool |
false |
no |
allow_app_config_access | Allow AppConfig access from the Lambda function. Ignored if policy_json or role_arn are set. |
bool |
true |
no |
app_config_extension_account_number | Account number for the AWS-AppConfig-Extension layer | string |
"027255383542" |
no |
app_config_extension_version | Lambda layer version for the AWS-AppConfig-Extension layer | number |
null |
no |
architectures | Architectures to target for the Lambda function | list(string) |
[ |
no |
cron | (optional) cron controlling schedule of task. Is set to 07:00 GMT (02:00 EST) by default. | string |
"00 7 * * ? *" |
no |
environment_vars | Map of environment variables for the Lambda. If null, defaults to setting an SSM_PATH based on the environment and name of the function. Set to {} if you would like for there to be no environment variables present. This is important if you are creating a Lambda@Edge. | map(any) |
null |
no |
ephemeral_storage_size | Size of the ephemeral storage in MB. Ignored if runtime is not supported. | number |
512 |
no |
event_rule_description | Value to use for the CloudWatch Event Rule. Will default to name if not defined. | string |
null |
no |
event_rule_name | Name of the CloudWatch Event Rule. Will default to name if not defined. | string |
null |
no |
file_system_config | File system configuration for the Lambda function | map(any) |
null |
no |
is_enabled | (optional) whether the rule is enabled. Is set to true by default. | bool |
true |
no |
lambda_description | Description for this lambda function | string |
null |
no |
lambda_insights_extension_account_number | Account number for the LambdaInsightsExtension layer | string |
"580247275435" |
no |
lambda_insights_extension_version | Lambda layer version for the LambdaInsightsExtension layer | number |
null |
no |
lambda_name | Name of the Lambda function | string |
null |
no |
layers | Lambda layers to apply to function. If null, a Lambda Layer extension is added by default. | list(string) |
null |
no |
log_retention_in_days | Number of days to retain CloudWatch Log entries | number |
7 |
no |
memory_size | Amount of memory in MB your Lambda Function can use at runtime | number |
128 |
no |
name | Name of the Lambda Cron Module. If null, will default to product. | string |
null |
no |
package_type | Package type for the Lambda function. Valid values are Zip and Image. | string |
"Zip" |
no |
parameters_and_secrets_extension_account_number | Account number for the AWS-Parameters-and-Secrets-Lambda-Extension layer | string |
"177933569100" |
no |
parameters_and_secrets_extension_version | Lambda layer version for the AWS-Parameters-and-Secrets-Lambda-Extension layer | number |
null |
no |
permissions_boundary_arn | ARN of the permissions boundary to use on the role created for this lambda | string |
null |
no |
policy_json | Policy JSON. If null, default policy granting access to SSM and cloudwatch logs is used | string |
null |
no |
publish | Whether to publish creation/change as new Lambda Function Version | bool |
true |
no |
role_arn | ARN of the role to be used for this Lambda | string |
null |
no |
security_group_id | Security group ID. If null, one will be created. | string |
null |
no |
ssm_path | SSM path to use for environment variables. If null, defaults to /${var.environment}/${local.name} | string |
null |
no |
subnets | Subnets to use for the Lambda function. Ignored if add_vpc_config is false. If null, one will be looked up based on environment tag. | list(string) |
null |
no |
tags | Extra tags | map(string) |
{} |
no |
timeout | Timeout in seconds of the Lambda | number |
3 |
no |
tracing_config_mode | Tracing config mode for X-Ray integration on Lambda | string |
"Active" |
no |
use_prefix | Use prefix for resources instead of explicitly defining whole name where possible | bool |
true |
no |
vpc_id | VPC ID. If null, one will be looked up based on environment tag. | string |
null |
no |
Name | Description |
---|---|
cron | Cron expression |
lambda_arn | ARN of the lambda |