Import finished, but now `terraform plan` shows a forced replacement on the imported resource.
AdvancedTroubleshootingImport, Already Exists and State Surgery
Answer
Likely causes → An argument in code that forces replacement differs from reality: availability_zone, subnet_id, name, engine, kms_key_id, or user_data with user_data_replace_on_change = true.
Diagnose → terraform plan | grep -B2 '# forces replacement', then terraform state show <addr> to see real values.
Fix → Change code to match the imported values exactly. Never apply an import PR that shows a replace.
Prevent → Add a CI rule: PRs containing import blocks must show zero delete and zero update actions.
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