terraform init -reconfigure
The init option that ignores any saved backend settings and sets the backend up from scratch, without copying existing state.
In more detail
Use it when the backend configuration changed and you do not want the old state carried over. If you do want the state moved, use -migrate-state instead.
Related terms
- terraform init — The command that prepares a directory for Terraform: it downloads providers, fetches modules, connects the backend and writes the lock file.
- terraform init -migrate-state — The init option that copies existing state from the old backend into a newly configured one.
- Terraform backend — The setting that decides where Terraform stores state and how it locks it, from a local file to shared cloud storage.
Taught in
- Initialising The Working Directory — Infrastructure as Code with Terraform
- Write, Plan, Apply, And What Init Prepares — HashiCorp Terraform Associate (004) Exam Prep
- Remote State With The Backend Block — HashiCorp Terraform Associate (004) Exam Prep
- Trap Sprint: Twelve Answers That Are Almost True — HashiCorp Terraform Associate (004) Exam Prep