How do you add an existing (already-created) resource to Terraform state?
Quick Answer
Use terraform import <resource_address> <resource_id> to bring an existing real resource under Terraform management by writing it into state; then add matching configuration so future plans do not try to recreate it.
Detailed Answer
Import only updates state — it does not generate config, so you must write the resource block (or use Terraform 1.5+ import blocks / -generate-config-out) to match reality, then run plan until it shows no changes. This is how you adopt manually-created infrastructure into IaC without downtime.
Code Example
terraform import aws_s3_bucket.logs my-existing-bucket # then write the aws_s3_bucket.logs block and plan until no changes
Interview Tip
Stress that import updates state but not config — you must write the block and plan to zero-diff, or mention 1.5+ import blocks.