rollback
Restore the environment’s state file from the newest state.<env>.json.bak.<timestamp> written before a save. Rollback is a local state-file operation — it never calls a cloud API and never destroys leftover resources.
kyku rollback [options]Options
Section titled “Options”| Flag | Default | Description |
|---|---|---|
-e, --env <environment> |
default |
Environment workspace |
--state-dir <dir> |
.kyku |
State directory |
--yes |
false |
Skip confirmation prompt |
Examples
Section titled “Examples”# Preview orphans, then confirmkyku rollback
# After a failed apply, restore the pre-apply backup without promptingkyku rollback --yes
# Production workspacekyku rollback --env=prod --yesBehavior
Section titled “Behavior”- Picks the newest
.bak.<timestamp>for the environment. If none exists, the command exits 1 with a clear error. - Writes the backup over the live state file without bumping
serial, so the restored file matches the backup. - Resources present in the discarded state but absent from the backup are printed as
ORPHANwith their provider ID. They stay in the cloud unless the failed apply used--rollback-destroy. Import them withkyku importor delete them in the cloud console. - Confirmation is required unless
--yesis set. - There is no automatic rollback on apply failure, no multi-step undo, and no remote-backend rollback.
After a failed apply
Section titled “After a failed apply”kyku apply copies the current state to a timestamped backup before mutating it. If the apply fails partway, kyku rollback puts the state file back to that pre-apply backup. Cloud resources created during the failed apply become orphans.
Exit Codes
Section titled “Exit Codes”| Code | Meaning |
|---|---|
| 0 | Restored, or the user aborted the confirmation |
| 1 | No backup, invalid backup, or other error |