Interview Prep/Terraform/Modules, Variables, Sensitive Values and Workspaces

After bumping a registry module from 4.x to 5.x, plan shows dozens of resources destroyed and recreated.

AdvancedTroubleshootingModules, Variables, Sensitive Values and Workspaces
Answer

Likely causes → Major module versions rename internal resources, switch count to for_each, or change defaults. Without moved blocks in the module (some include them), addresses no longer match.

Diagnose → Read the module's upgrade guide/CHANGELOG; list destroyed vs created addresses from terraform show -json tfplan.

Fix → Revert the bump. Add moved blocks in your root mapping old → new addresses, set any changed defaults explicitly, and re-plan until only expected in-place updates remain.

Prevent → Pin modules with ~> 4.2 (no surprise majors), and upgrade majors in a dedicated PR per stack.

All Terraform questions Roadmap: Terraform

More on Modules, Variables, Sensitive Values and Workspaces