Introduction
Sometimes Terraform's state file has resources that no longer exist or should be managed outside Terraform. The terraform state rm command removes these resources from the state without deleting the actual infrastructure.
When you manually delete a resource outside Terraform and want to update the state to match.
When you want to stop managing a resource with Terraform but keep it running.
When you imported a resource by mistake and want to remove it from state.
When cleaning up state entries for resources that no longer exist.
When splitting infrastructure management between different Terraform projects.