Interview Prep/Terraform/Import Refactoring Drift and Lifecycle

A CloudFormation stack owns resources that you want in Terraform. How do you migrate?

IntermediateScenarioImport Refactoring Drift and Lifecycle
Answer

Situation read → Two tools claim the same resources.

What I'd do →

  1. Update the CFN template to set DeletionPolicy: Retain on every resource and deploy it.
  2. Import the resources into Terraform and get a clean plan.
  3. Delete the stack; resources stay because of Retain.

Why → Retain makes stack deletion non-destructive, so ownership moves safely.

Interview tip → Do it in order; deleting the stack first would delete the infrastructure.

All Terraform questions Roadmap: Terraform in production

More on Import Refactoring Drift and Lifecycle