Interview Prep/Terraform/Refactoring, Migration and Drift

How do you import a large existing environment efficiently?

IntermediateProductionRefactoring, Migration and Drift
Answer

Use import blocks with terraform plan -generate-config-out=generated.tf to draft configuration, then clean it up into modules and variables (generated code is verbose and hardcoded). Tools like Terraformer or aws2tf can inventory a region. Import in layers (network first), validate with empty plans and avoid importing resources you plan to retire.

All Terraform questions Roadmap: Terraform in production

More on Refactoring, Migration and Drift