Interview Prep/Real-World Interview/Infrastructure as Code & Terraform state

How did you import existing resources into Terraform?

IntermediateBehavioralInfrastructure as Code & Terraform state
Answer

Good answer looks like → "We had about 80 resources created by hand. I used import blocks (Terraform 1.5+) and terraform plan -generate-config-out=generated.tf to draft the config, then cleaned it up into our modules. The goal was a plan with no changes after import, which proved the code matched reality."

import {
  to = aws_s3_bucket.assets
  id = "acme-prod-assets"
}

Follow-ups to expect → What resources were hard to import? How did you handle resources inside modules?

Red flags → Recreating production resources instead of importing them.

All Real-World Interview questions Roadmap: Interview readiness

More on Infrastructure as Code & Terraform state