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.
More on Infrastructure as Code & Terraform state
What did your Terraform state setup look like?IntermediateHow did you structure your Terraform code?BeginnerWhy did you use folders per environment rather than Terraform workspaces (or vice versa)?IntermediateHow did different Terraform stacks share information?IntermediateDid you ever have a state lock or corrupted state? What did you do?AdvancedHow did you handle Terraform drift?Intermediate