Worker Cron Triggers allow users to map a cron expression to a Worker script
using a ScheduledEvent
listener that enables Workers to be executed on a
schedule. Worker Cron Triggers are ideal for running periodic jobs for
maintenance or calling third-party APIs to collect up-to-date data.
resource "cloudflare_worker_script" "example_script" {
account_id = "f037e56e89293a057740de681ac9abbe"
name = "example-script"
content = file("path/to/my.js")
}
resource "cloudflare_worker_cron_trigger" "example_trigger" {
account_id = "f037e56e89293a057740de681ac9abbe"
script_name = cloudflare_worker_script.example_script.name
schedules = [
"*/5 * * * *", # every 5 minutes
"10 7 * * mon-fri", # 7:10am every weekday
]
}
account_id
(String) The account identifier to target for the resource.schedules
(Set of String) Cron expressions to execute the Worker script.script_name
(String) Worker script to target for the schedules.id
(String) The ID of this resource.Import is supported using the following syntax:
$ terraform import cloudflare_worker_cron_trigger.example <account_id>/<script_name>