Sunday, July 10, 2022

[SOLVED] Terraform AWS - ScheduleExpression is not valid

Issue

I am trying to create a resource

resource "aws_cloudwatch_event_rule" "foo" {
  ..
  schedule_expression = "cron(*/5 * * * * *)"
}

And I want it to run every 5 minutes. Terraform says this expression is not valid:

ValidationException: Parameter ScheduleExpression is not valid.

What am I doing wrong?

Note that I don't want to use rate(5 minutes) because I want it to run at minutes which are multiplies of 5 (00, 05, 10, 15, 20, [...], 55).


Solution

It should be:

cron(*/5 * ? * * *)

enter image description here



Answered By - Marcin
Answer Checked By - Terry (WPSolving Volunteer)