Reputation: 7732
I applied half of a terraform plan then lost my state file, so now terraform doesn't know about the AWS resources that it created previously. When I try to apply again, it complains that conflicting resources already exist.
Manually deleting them and re-creating them will be faster than manually importing them, but I am hopeful there's an automated way to delete them that's even faster?
Upvotes: 1
Views: 244
Reputation: 74594
Unfortunately the state is the sole location where Terraform tracks which objects a particular configuration is managing, so if you have lost it then Terraform has no way to recover that information automatically.
Unless you have some other record of what actions your previous Terraform runs performed -- for example, saved output produced by Terraform CLI reporting what objects it was creating -- you will need to rely only on information you can find from your target platform to determine which objects ought to be deleted.
Upvotes: 0