0

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).

ablaszkiewicz1
  • 855
  • 1
  • 10
  • 26
  • Does this answer your question? [Parameter ScheduleExpression is not valid](https://stackoverflow.com/questions/39482314/parameter-scheduleexpression-is-not-valid) – Abdul Aziz Barkat Jun 23 '22 at 11:22

1 Answers1

0

It should be:

cron(*/5 * ? * * *)

enter image description here

Marcin
  • 215,873
  • 14
  • 235
  • 294
  • Taken from cloudwatch docs: The * (asterisk) wildcard includes all values in the field. In the Hours field, * would include every hour. You cannot use * in both the Day-of-month and Day-of-week fields. If you use it in one, you must use ? in the other. – Erik Asplund Jun 23 '22 at 11:22