This script will use a mapping of old and new Terraform resources path to move from an exisiting state to a new state. This is handy when restructuring a Terraform project.
- In exisiting project:
- Make sure you have intiiated with the correct state backend (if you are using different state backends)
- Run
terraform state list
and grab the paths. you would need to filter between resource paths and other paths like data blocks
- In new structure:
- Run
terraform init