Terraform stores information about your infrastructure in a state file. This state file keeps track of resources created by your configuration and maps them to real-world resources. Terraform compares your configuration with the state file and your existing infrastructure to create plans and make changes to your infrastructure.
Try the hands-on, command-line tutorial to use the Terraform CLI to remove, taint, and re-import resources.
If you have any questions, ask away! Happy Terraforming!