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

`Error: Moved object still exists` after adding a `moved` block.

IntermediateTroubleshootingImport, Already Exists and State Surgery
Answer

Likely causes → The from address is still declared in code, so it isn't actually moved (you copied the block instead of renaming it).

Diagnose → grep -rn 'resource "aws_s3_bucket" "logs"' . finds both old and new blocks.

Fix → Delete or rename the old resource block so only the to address exists.

Prevent → Rename and add the moved block in the same commit; review that the old address disappears.

All Terraform questions Roadmap: Terraform in production

More on Import, Already Exists and State Surgery