Terraform wants to rebuild my entire AWS deployment

I have an AWS environment that was built 100% with Terraform. I haven't touched it in a few days, but today when I went to make what I thought was a fairly trivial change, Terraform has decided that it wants to build me an entire new AWS infrastructure. Backing out of the change made no difference, no matter what I do, Terraform now wants to build new infrastructure.

It does not want to tear the old infrastructure down, it wants to build this new infrastructure side-by-side with it.

It's basically acting like all my pre-existing infrastructure just doesn't exist.

I suspect it's because everything is tied to a VPC, and because it thinks it needs to create a new VPC everything downstream of the VPC (i.e. everything) is also re-created so the IDs match.

I'm very new to Terraform, so is there any way I can "force" Terraform back into its old state?


It would appear an errant global find and replace was to blame for this problem - it modified the Terraform state file, which cause this cascading issue.

Restoring a version of the state file that did not have this issue has fixed the issue.

I think it's time to get the terraform state file into S3 so this doesn't happen again.