When creating a resources.json file for `pulumi im...
# general
c
When creating a resources.json file for
pulumi import
, how should we handle resources that do not actually exist, like providers and components? Context: I reimplemented a legacy TF code base with Pulumi. Now I want to write a script that generates a
resources.json
import file based on the terraform state. According to https://www.pulumi.com/docs/guides/adopting/import/,
id
is mandatory, but when reading a Pulumi state file, components have no ID.
Where can I see an example of a
resources.json
file that import resources with components as parents?
Update, for those who face the same kind of migration: passing
opts=ResourceOptions(import_="cloud-provider-identifier")
makes it much easier!
a
At the moment, it’s not possible to import resources that don’t actually exist in the underlying provider.
import
is essentially a way to tell Pulumi: “grab the underlying state of a resource from a cloud provider”. I think you’ll need to add components and providers after you run the import.
c
@ancient-policeman-24615 Passing
opts=ResourceOptions(import_="cloud-provider-identifier")
did the trick. I am now able to import all legacy resources into my Pulumi state, with components. 🙂