https://pulumi.com logo
#general
Title
# general
f

fierce-ability-58936

12/15/2022, 7:27 PM
We've got a lot of projects created with our own set of terraform modules. We'd like to eventually migrate them to Pulumi without recreating everything from scratch. Let's say we've got the new modules sorted, and now we need to import the infrastructure. I've tried the following: 1. Parse terraform state and use transformations to add import resource option. That kind of works but only if the resource is 100% the same - which is not always the case, i.e. we decided to change tagging or something, or improve things on the way, throwing out some legacy. 2. There's
pulumi import
but that doesn't 100% fit either. We can construct an import json from the terraform file, but making the right hierarchy will be tricky. 3. None of the above is scalable! So I was thinking: is there an easy way to modify Pulumi in the following way: 1. Add another flag to
pulumi import
, say
--import-existing
or something. 2. Pulumi will have all the information about the resource hierarchy and it should be able to query for existing resources. 3. If existing resources match the code (by id?), import them into the state. Those resources don't have to be a perfect match. Does it make sense? Does it sound hard to implement?
b

billowy-army-68599

12/15/2022, 7:33 PM
Could you write this up into an issue? Our engineering team is working on this and I think they’d love the feedback
f

fierce-ability-58936

12/15/2022, 7:34 PM
Should I create a new one or it's already somewhere there?
Couldn't find anything similar, so https://github.com/pulumi/pulumi/issues/11669
Will be happy to alpha-test!
e

echoing-dinner-19531

12/15/2022, 8:00 PM
I'm currently working on an overhaul of our terraform code to pulumi code converter, one part of that (which admittedly I haven't started on yet but is planned) is to also support importing any terraform state with the program as well. So you'll eventually have something like
pulumi config --from tf --langauge typescript
and get back the typescript files and pulumi stacks for all the terraform workspaces.
f

fierce-ability-58936

12/15/2022, 8:23 PM
That sounds nice! I tried to use https://www.pulumi.com/tf2pulumi/, more as a helper to get the skeleton of the module, the other day but our code is way newer than 0.12.
e

echoing-dinner-19531

12/15/2022, 9:27 PM
Yup it's not been well maintained over the years. Hopefully have a new thing soon after the Christmas holidays.
s

salmon-gold-74709

12/18/2022, 9:22 AM
We're evaluating Pulumi at present and Terraform to Pulumi is a key part of this - it would be great to see this updated! 👍 Still figuring out the best way to migrate our sometimes messy state - we might need to import from AWS to TF state first in some cases.