After `terraform state mv aws_instance.web module.app.aws_instance.web`, the plan wants to destroy the instance and create a new one.
IntermediateTroubleshootingImport, Already Exists and State Surgery
Answer
Likely causes → The destination address doesn't match the code (module is called module.application, or the resource uses count so it needs [0]); the state now has the object at an address the code doesn't declare.
Diagnose → terraform state list | grep aws_instance vs the code address shown in the plan's + create.
Fix → Move again to the exact address in the plan:
terraform state mv 'module.app.aws_instance.web' 'module.application.aws_instance.web[0]'
Prevent → Prefer moved blocks; terraform plan shows has moved to and you see mistakes before state changes.
More on Import, Already Exists and State Surgery
Apply fails with `EntityAlreadyExists: Role with name app-role already exists.`Beginner`terraform apply` on a new bucket fails with `BucketAlreadyExists`. You have never created that bucket.Beginner`Error: Resource already managed by Terraform` when running `terraform import aws_s3_bucket.logs acme-logs`.Beginner`Error: Cannot import non-existent remote object` for a resource you can see in the console.Intermediate`Error: Configuration for import target does not exist` when running `terraform plan` with an `import` block.Beginner`terraform plan -generate-config-out=generated.tf` fails with `Conflicting configuration arguments` in the generated file.Intermediate