diff --git a/main.tf b/main.tf index 89c717a..4f32272 100644 --- a/main.tf +++ b/main.tf @@ -35,6 +35,7 @@ module "event-cloudwatch" { name = lookup(var.event, "name", null) name_prefix = lookup(var.event, "name_prefix", null) schedule_expression = lookup(var.event, "schedule_expression", "") + input = lookup(var.event, "input", {}) } module "event-dynamodb" { diff --git a/modules/event/cloudwatch-event/main.tf b/modules/event/cloudwatch-event/main.tf index 39a6ff8..003ceb7 100644 --- a/modules/event/cloudwatch-event/main.tf +++ b/modules/event/cloudwatch-event/main.tf @@ -15,6 +15,7 @@ resource "aws_cloudwatch_event_rule" "lambda" { name = var.name name_prefix = var.name_prefix schedule_expression = var.schedule_expression + input = var.input } resource "aws_cloudwatch_event_target" "lambda" { diff --git a/modules/event/cloudwatch-event/variables.tf b/modules/event/cloudwatch-event/variables.tf index 57c9aa9..82cbd49 100644 --- a/modules/event/cloudwatch-event/variables.tf +++ b/modules/event/cloudwatch-event/variables.tf @@ -47,3 +47,8 @@ variable "schedule_expression" { description = "(Required, if event_pattern isn't specified) Scheduling expression for triggering the Lambda Function using CloudWatch events. For example, cron(0 20 * * ? *) or rate(5 minutes)." } +variable "input" { + description = "A key-value map to assign as input to the Lambda function." + type = map(string) + default = {} +}