Hi all, is it possible to import resources program...
# python
b
Hi all, is it possible to import resources programmatically with Python rather than the Pulumi CLI import? I also noticed this issue: https://github.com/pulumi/pulumi/issues/3388, which would be a workaround but it seems to be neglected as it still points to the 2025 Q1 roadmap.
I found: https://www.pulumi.com/docs/iac/concepts/resources/options/import/ Which gives me the followup question: is there a way to check if a resource is already in the stack or does
import_
already checks that for us? Because in the docs it mentions the following: "Once a resource is successfully imported, remove the
import
option because Pulumi is now managing the resource."
e
which would be a workaround but it seems to be neglected
Its not neglected its just surprisingly very hard, we keep thinking about it. Was discussed internally a couple of months ago, where we still didn't have a good answer.
Which gives me the followup question: is there a way to check if a resource is already in the stack or does
import_
already checks that for us?
Import option will only be used if the logical resources is new to the stack.
s
You can conditionally add the import resource option. @echoing-dinner-19531 I would assume that you can also import resources via Automation API. Is that correct?
e
Currently not, oddly we don't expose the
pulumi import
command via automation. But we are overhauling that so it'll probably get added soon.
s
Best way then must be conditionally applying the import resource option b/c I have definitely seen a customer do something like this.
b
Yes, thank you guys for the guidance I can work with this 🙂
❤️ 1