Roll back workspace state
Roll a workspace's Terraform or OpenTofu state file back to a previous version from the State tab.
State rollback restores a workspace's OpenTofu/Terraform state file to a previous version directly from the workspace State tab. Harness copies the selected historical state to a new version, so you recover from a failed apply or a corrupted state without manual CLI surgery. Rollback restores the state record Harness has on file. It does not change your cloud infrastructure.
Before you begin
Workspace state history: A workspace with at least one prior state version. Go to Provision workspace to run a pipeline that stores state.
Rollback permission: The
WorkspaceRollbackStatepermission on the workspace. Go to Workspace RBAC to configure roles.Unlocked workspace: No Terraform operation is holding a lock on the workspace. Go to Workspace Statuses to review the current state.
How rollback works
Rollback uses a roll-forward model: Harness never overwrites or deletes an existing state version. Instead, it creates a new version whose contents match the version you select.
Harness performs a server-side copy of the selected
state_rawobject to a new state version with a fresh version timestamp.The workspace's active state pointer is repointed to the new version, and the source version is recorded on the new row so the rollback is traceable.
Every historical version is retained, so you can roll back again at any time.
Because rollback creates a new version rather than editing history, you keep a full audit trail and never lose a prior state.
Roll back state from the State tab
Open your workspace and go to the State tab. The tab lists the state version history.
Identify the last known-good state version.
Select Rollback to this version on that version.
Review the confirmation modal, which explains that rollback creates a new state version matching the selected snapshot and does not modify real-world resources.
Optionally enter a reason for the rollback. The reason is stored on the audit record.
Confirm the rollback.
After rollback completes:
The workspace status changes to
rollback_applied.A
rollbackentry is added to the Activity History tab, recording who performed the rollback, the source version, the optional reason, and the timestamp.
State rollback with external backends
Rollback is available for every workspace, but its effect depends on where your state is stored.
Harness-managed backend: Rollback repoints the workspace to the restored state version, and that version is used by the next run.
External backend (S3, Azure Blob, GCS, Terraform Cloud, and others): Rollback updates only the copy of the state Harness displays. The next plan or apply reads the state from your real backend and overwrites the display copy. For external-backend workspaces, rollback is effectively a display-only operation.
Harness does not detect the backend type on your behalf. The confirmation banner communicates this behavior so you can decide whether rollback is appropriate for your workspace.
Troubleshooting
Next steps
Rollback restores your state record; the next run reconciles it with real infrastructure.
Go to Provision workspace to run a plan and apply after rollback.
Go to Workspace Statuses to understand the
rollback_appliedstatus.Go to Workspace Settings to review the State and Activity History tabs.
Last updated
Was this helpful?