r/devops • • Sep 17 '26

Tools Migrating existing CloudFormation resources to OpenTofu -recommended approach?

Hi everyone,

We’re planning to migrate a large number of existing AWS resources currently managed through CloudFormation to OpenTofu.

Our environments are fairly siloed per customer, and each environment can include resources such as EC2 instances, load balancers, Auto Scaling Groups, VPCs, security groups, and other AWS services.

I’m looking for recommendations from anyone who has gone through a similar migration.

Specifically:

- Are there any tools that can help convert or migrate existing CloudFormation stacks to OpenTofu?

- What is the best approach for importing existing resources into OpenTofu state?

- How did you handle dependencies between resources during the migration?

- Would you recommend migrating one CloudFormation stack/customer environment at a time?

- Are there any common pitfalls or state-management issues we should watch out for?

- What approach would minimize the risk of OpenTofu trying to modify or recreate existing production resources after import?

Our main priority is to make the migration as safe and predictable as possible, with minimal disruption to existing customer environments.

Would appreciate hearing about any tools, workflows, or lessons learned from real-world migrations.

20 Upvotes

15 comments sorted by

View all comments

1

u/cloudfixer_dev Sep 25 '26

To echo the DeletionPolicy: Retain advice (which is absolutely the most critical step here), the golden rule for this migration is: Do not import and refactor at the same time.

Your safest path looks exactly like this:

  1. Set CF DeletionPolicy to Retain.
  2. Import resources to Tofu state.
  3. Run a plan. Spam lifecycle { ignore_changes } until you get a perfect, clean No changes plan.
  4. Delete the CF stack.
  5. Let it bake for a few days. Then start refactoring into dry modules.

Trying to optimize your IaC structure while actively migrating state is how you accidentally nuke a production VPC. Treat the state takeover and the code cleanup as two completely separate projects.