Interview Prep/Terraform/Import, Already Exists and State Surgery

A `moved` block from `null_resource.bootstrap` to `terraform_data.bootstrap` fails with a resource type mismatch on an old Terraform version.

AdvancedTroubleshootingImport, Already Exists and State Surgery
Answer

Likely causes → Cross-type moves need Terraform 1.8+ and provider support. null_resource → terraform_data is supported from 1.9; older versions reject any move between different types.

Diagnose → terraform version locally and in CI.

Fix → Upgrade to 1.9+ everywhere and keep the moved block. On older versions, use removed { lifecycle { destroy = false } } plus a new terraform_data (which will re-run its provisioner) or accept the replacement.

Prevent → Check the minimum Terraform version for refactor features and bump required_version in the same PR.

All Terraform questions Roadmap: Terraform in production

More on Import, Already Exists and State Surgery