Table of Contents

The Error

When working with Terraform, you may encounter this error:

Error: Moved object still exists at old address

This error can block your entire workflow. Let’s understand why it happens and how to fix it.

What Causes This Error

A moved block references a source that still exists in configuration, or the move hasn’t been applied yet.

How to Fix It

Solution 1

Remove the old resource block after adding the moved block.

Solution 2

Run terraform plan to verify the move, then terraform apply to execute it.

Solution 3

If the move is complete, remove the moved block from configuration.

Solution 4

For complex renames, use terraform state mv as an alternative to moved blocks.

Prevention Tips

  • Always run terraform validate before terraform plan
  • Use terraform fmt to keep configuration clean and readable
  • Pin provider versions to avoid unexpected schema changes
  • Review plan output carefully before applying

Learn More

Conclusion

This error is common but straightforward to fix. The key is understanding the root cause and applying the correct solution for your specific situation. Following the prevention tips above will help you avoid this error in future projects.