The Terraform State Backup file which is named as terraform.tfstate.backup is a backup of your Terraform state file. When you make changes to the infrastructure (by running terraform apply) and update the state file, Terraform automatically creates a backup of the previous state file before applying the changes.
Terraform state backup file looks like below.

Key Points About the Terraform State Backup File:
Automatic Backup:
Whenever you run terraform apply, Terraform automatically creates a backup of the current state file. This backup is stored in the same directory as terraform.tfstate.backup. It’s a simple yet crucial feature to help safeguard your infrastructure state.
Purpose of the Backup:
The backup file acts as a safeguard. If something goes wrong during a deployment, or if a change causes issues or corruption to the state file, the backup allows you to revert to the previous state. This can be a lifesaver when troubleshooting infrastructure issues or recovering from unexpected errors.
Versioning and Rollback:
While the backup provides a basic form of version control, it only stores the most recent previous state before changes are applied. This works well for simple use cases, but for more complex, multi-team environments, you’ll want a more robust solution. Using remote backends (like Terraform Cloud) provides proper state file versioning, allowing you to roll back to specific versions when needed. While some might think GitHub is a viable option to store Terraform State files, and the answer is firm NO. It’s not recommended to use GitHub (or other Git-based version control systems) for storing Terraform state files. The state file often contains sensitive information such as secrets, resource IDs, and configuration details, which shouldn’t be publicly or even privately exposed in a Git repository.
Backup Safety Considerations:
It’s important to note that Terraform only keeps a single backup file — the immediate previous state. You won’t get multiple versions or a history of changes beyond that. And just like the state file itself, the backup may contain sensitive information, so ensure it’s stored securely and not exposed to unauthorized access.
Remote Backend Backups:
When you’re using a remote backend for state storage (such as Azure Blob Storage, Terraform Cloud, or AWS S3), Terraform manages backups automatically by versioning the state in the remote storage. This eliminates the need for local backups and provides a more reliable way to manage state history. In the event you need to revert to a previous state, the remote backend’s versioning features make that process seamless.
Happy Learning 🙂