Resource

dcloud_app_job

A scheduled job of an app: a command run on a five-field cron schedule (UTC) on one of the app's machines, in the app's image with its environment.

Example Usage

resource "dcloud_app_job" "nightly_cleanup" {
  app_id      = dcloud_app.web.id
  name        = "nightly-cleanup"
  schedule    = "0 3 * * *"
  command     = "node scripts/cleanup.js"
  timeout_sec = 900
  concurrency = "skip"
}

Schema

Required

  • app_id (String) The id of the parent resource ({id} in the path). Changing it replaces the resource.
  • command (String) Command run with /bin/sh -c in the app’s image, with the app’s environment. Up to 4096 characters.
  • name (String) Name of the job, unique within the app. Up to 63 characters. Must match ^[a-z0-9]([a-z0-9-]*[a-z0-9])?$.
  • schedule (String) Five-field cron expression, UTC, e.g. 0 3 * * *.

Optional

  • concurrency (String) What happens when a run is due while the previous one is still going: skip (a new job’s default) records it as skipped, allow starts it anyway One of: skip, allow.
  • enabled (Boolean) Whether the job runs on its schedule; a new job is enabled unless this is false
  • service (String) A compose app's service to run the command in; empty for any other app.
  • timeout_sec (Number) Seconds a run may take before it is stopped; a new job gets 3600. From 10 to 86400.
  • timezone (String) Time zone of the schedule; only UTC

Read-Only

  • id (String) The resource's id.
  • schedule_description (String) The schedule in words.

Import

Import is supported using the following syntax:

The terraform import command can be used, for example:

terraform import dcloud_app_job.nightly_cleanup <app-id>/<job-id>

Generated from the provider's schema.