rso_scheduled_job (Resource)¶
A container that runs on a cron schedule: reports, cleanups, syncs. A job starts, does its work and stops.
The job gets the CPU and memory it asks for and nothing else from the platform: no volumes and no identity in the cluster. Pass configuration through env, secrets through secret_name and secret_key.
Example Usage¶
resource "rso_scheduled_job" "backup" {
name = "nightly-backup"
image = "ghcr.io/example/backup:1.4"
args = ["--target", "s3://backups"]
schedule = "15 1 * * *"
cpu = 0.5
memory_mb = 512
timeout_seconds = 1800
retries = 2
env = [
{ name = "LOG_LEVEL", value = "info" },
{ name = "S3_SECRET_KEY", secret_name = rso_secret.backup.name, secret_key = "S3_SECRET_KEY" },
]
}
Schema¶
Required¶
cpu(Number) vCPU for each run, for example0.25.image(String) Container image to run.memory_mb(Number) Memory for each run, in MiB.name(String) Job name, unique within the tenant.schedule(String) Five-field cron expression (minute hour day month weekday), in UTC. The platform sets a minimum interval between runs.
Optional¶
args(List of String) Arguments to the entrypoint.command(List of String) Overrides the image's entrypoint.concurrency(String) What happens when a run is due while the previous one is still going:FORBIDskips it (the default),ALLOWruns both,REPLACEstops the old one.env(Attributes List) Environment variables. Each has either avalueor a reference to a key of anrso_secret. (see below for nested schema)image_pull_secrets(List of String) Names of pull secrets for a private registry.retries(Number) How often a failed run is retried. Defaults to the platform's default.suspended(Boolean) Set totrueto keep the job but stop scheduling it.timeout_seconds(Number) Longest a run may take, retries included. Defaults to the platform's default.
Read-Only¶
id(String) Same asname.
Nested Schema for env¶
Required:
name(String) Variable name.
Optional:
secret_key(String) Key within the secret.secret_name(String) Secret to read the value from.value(String) Literal value.
Import¶
Import is supported using the following syntax:
# Import a scheduled job by its name.
terraform import rso_scheduled_job.backup nightly-backup