Brings existing AWS resources into Terraform management — without recreating them.
Resource already exists in AWS (created manually)
↓
You write HCL and run terraform apply
↓
ERROR: resource already exists!
Import fixes this by linking the existing resource to your HCL code.
1. Resource exists in AWS (created manually)
2. Write empty resource block in HCL
3. terraform import <resource_address> <aws_id>
4. terraform state show <resource> — see what was imported
5. Copy config from state into your HCL code
6. terraform plan — verify no changes
7. Done — Terraform now manages this resource
You created daksh-ex-demo bucket in AWS Console months ago. Now you want Terraform to manage it.
resource "aws_s3_bucket" "main" {
# empty for now
}