The other day I was updating some of my Terraform configurations and as I went through my various deployments, I realized that my state file layout and naming convention has changed over time. I have a bunch of files in S3 in different locations with various names. I decided to clean them up and get to a standard naming convention, but I didn’t want to lose or have to redeploy any of my current deployments.
I went to Google to try and find the right way to do this. Most everything I found related to either moving resources from one state file to another or pulling it down local and re-uploading it. I felt like I should be able to just move the file to the new name and then update my configuration to use the new file. Since I could not find anyplace that stated that method was possible, I decided to try it and see what happens. End result? It works just fine. Using the AWS CLI, I moved my files in S3 and then updated my Makefile to point to the new state file.
I love it when things are that easy.