You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add ephemeral / auto-destroy workspaces: scheduled destroy at a set time, and/or auto-destroy after a period of state inactivity (TTL). TFE/HCP Terraform offers both (paid tiers); it's a top cost-control feature for short-lived/test environments. The machinery to do this safely already exists in Terrapod.
TFE/HCP parity reference
Scheduled destroy: one-shot destroy at a specific date/time.
Auto-destroy on inactivity: destroy after N hours/days without a state change; reschedules on each apply.
DB (Workspace): auto_destroy_at (TIMESTAMPTZ, nullable — one-shot), auto_destroy_inactivity (interval/seconds, nullable — TTL since last state change), auto_destroy_status. Both null = disabled (default; safe).
Trigger: a new distributed-scheduler periodic task (scheduler.py, multi-replica safe, no leader election) — auto_destroy_check — finds workspaces where now >= auto_destroy_at OR now - last_state_change >= auto_destroy_inactivity, and queues an is_destroy + auto_apply run with a dedicated source = "auto-destroy".
Completion: reuse the existing Autodiscovery Workspace Lifecycle Management #314 pattern — the opt-in-destroy → archive hook in run_service.transition_run is keyed on a literal run.source; add "auto-destroy" so a successful destroy archives (not deletes) the workspace. Inactivity timer resets naturally on the next applied state version.
Notifications: reuse the notification dispatcher — emit reminder (configurable lead time) + result events; add run:auto_destroy_* triggers to the existing trigger set.
Summary
Add ephemeral / auto-destroy workspaces: scheduled destroy at a set time, and/or auto-destroy after a period of state inactivity (TTL). TFE/HCP Terraform offers both (paid tiers); it's a top cost-control feature for short-lived/test environments. The machinery to do this safely already exists in Terrapod.
TFE/HCP parity reference
Proposed design (Terrapod-native, reuses existing machinery)
auto_destroy_at(TIMESTAMPTZ, nullable — one-shot),auto_destroy_inactivity(interval/seconds, nullable — TTL since last state change),auto_destroy_status. Both null = disabled (default; safe).scheduler.py, multi-replica safe, no leader election) —auto_destroy_check— finds workspaces wherenow >= auto_destroy_atORnow - last_state_change >= auto_destroy_inactivity, and queues anis_destroy+auto_applyrun with a dedicatedsource = "auto-destroy".run_service.transition_runis keyed on a literalrun.source; add"auto-destroy"so a successful destroy archives (not deletes) the workspace. Inactivity timer resets naturally on the next applied state version.reconcile_branch_advance); never act if a run is already active on the workspace.run:auto_destroy_*triggers to the existing trigger set.Scope / non-goals
Acceptance criteria
is_destroyauto-apply run at the right time; dedupe holds across poll cycles and replicas.