Removing last record terraform state in a terraform workspace

Unfortunately, there’s no particularly smooth way to roll back to an earlier version of state. However, you should be able to straighten this out by uploading the old state version a second time so that the workspace considers it to be the latest!

First you’ll need to find the state file you’d like to roll back to and download it to your local machine (you should see a “Download” button when looking at the state version in the UI).

Then you should be able to use the terraform state push command to re-upload that state file (you may need the -force option). In a pinch, you can use the API directly.

1 Like