`Error: Resource already managed by Terraform` when running `terraform import aws_s3_bucket.logs acme-logs`.
BeginnerTroubleshootingImport, Already Exists and State Surgery
Answer
Likely causes → That address already has an object in state. Terraform refuses to import over it.
Diagnose → terraform state show aws_s3_bucket.logs — is it the same bucket or a different one?
Fix → If it's the same bucket, nothing to do. If the state points to a wrong/deleted object, terraform state rm aws_s3_bucket.logs first, then import.
Prevent → Use import blocks in PRs so the plan shows what will be imported before anything 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: 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.IntermediateAfter importing an S3 bucket, the plan still shows `+ force_destroy = false` as an update.Beginner