Interview Prep/Terraform/Refactoring, Migration and Drift

How would you migrate from CloudFormation to Terraform?

AdvancedProductionRefactoring, Migration and Drift
Answer

Per stack, not all at once. Import the real resources into Terraform, set the CloudFormation stack's DeletionPolicy: Retain on everything, then delete the CFN stack (or retain-resources) so resources survive without a manager. Confirm with an empty Terraform plan before removing the CFN stack. Tools such as former2 help to draft code, though results need cleanup.

All Terraform questions Roadmap: Terraform in production

More on Refactoring, Migration and Drift