I am having a problem with my terraform. my lambda is expecting a specific format of message from CloudWatch event rule
resource "aws_cloudwatch_event_rule" "send_hello" {
name = "say-hi"
schedule_expression = "cron(0/5 * * * *)"
is_enabled = true
event_pattern = <<PATTERN
{
"who": "Peter",
"message_part_1": "hello",
"message_part_2": "this is the world"
}
PATTERN
}
I am getting
"who" must be an object or array
my lambda needs to receive an event of
{
"who": "Peter",
"message_part_1": "hello",
"message_part_2": "this is the world"
}
how should I format my event pattern?
ADDITIONAL: the following changes do create the resource, but there is no "who" or "message" in the event when the rule calls lambda
resource "aws_cloudwatch_event_rule" "send_hello" {
name = "say-hi"
schedule_expression = "cron(0/5 * * * *)"
is_enabled = true
event_pattern = <<PATTERN
{
"who": ["Peter"],
"message_part_1": ["hello"],
"message_part_2": ["this is the world"]
}
PATTERN
}