pulumi/pulumi · error

--cron is required for --kind=drift

Error message

--cron is required for --kind=drift

What it means

A drift-detection schedule runs on a recurring basis, so it requires a cron expression; one-shot timing (--once) is not supported for drift. validateScheduleNewArgs enforces this at pkg/cmd/pulumi/stack/stack_schedule_new.go:318.

Source

Thrown at pkg/cmd/pulumi/stack/stack_schedule_new.go:319

func validateScheduleNewArgs(kind string, args stackScheduleNewArgs) error {
	switch kind {
	case scheduleKindRaw:
		if args.cron == "" && args.once == "" {
			return errors.New("one of --cron or --once is required for --kind=raw")
		}
		if args.operation == "" {
			return errors.New("--operation is required for --kind=raw")
		}
		if args.autoRemediate {
			return errors.New("--auto-remediate is only valid for --kind=drift")
		}
		if args.deleteAfterDestroy {
			return errors.New("--delete-after-destroy is only valid for --kind=ttl")
		}
	case scheduleKindDrift:
		if args.cron == "" {
			return errors.New("--cron is required for --kind=drift")
		}
		if args.once != "" {
			return errors.New("--once is not valid for --kind=drift; use --cron")
		}
		if args.operation != "" {
			return errors.New("--operation is not valid for --kind=drift")
		}
		if args.deleteAfterDestroy {
			return errors.New("--delete-after-destroy is only valid for --kind=ttl")
		}
	case scheduleKindTTL:
		if args.once == "" {
			return errors.New("--once is required for --kind=ttl")
		}
		if args.cron != "" {
			return errors.New("--cron is not valid for --kind=ttl; use --once")
		}
		if args.operation != "" {

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Add a --cron expression, e.g. --cron "0 */6 * * *".
  2. If you need a one-shot run, use --kind=raw --once ... --operation refresh instead.

Example fix

// before
pulumi stack schedule new --kind=drift --once "2026-09-01T00:00:00Z"
// after
pulumi stack schedule new --kind=drift --cron "0 */6 * * *"
Defensive patterns

Strategy: validation

Validate before calling

KIND=drift
if [ "$KIND" = drift ] && [ -z "$CRON" ]; then echo "--cron is required for --kind=drift"; exit 1; fi

Try / catch

if ! pulumi stack schedule new --kind=drift --cron "$CRON"; then
  echo "verify the cron expression and required --cron flag"
fi

Prevention

When it happens

Trigger: Running `pulumi stack schedule new --kind=drift` with neither --cron nor with only --once set.

Common situations: Adapting a raw one-shot schedule command to kind=drift while keeping --once; forgetting that drift schedules are always recurring.

Related errors


AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31). Data as JSON: /api/errors/8495d002039c73f8. Report an issue: GitHub.