This message was deleted.
# general
s
This message was deleted.
l
The options are to write the code yourself and add the
import
opt, or have Pulumi write the code for you using
pulumi import
. You never need to figure out parents, since that's just a cosmetic thing (unless you're inheriting opts / providers). Import IDs are calculated for you if you use
pulumi import
There's no way to specify an import id on the command line. It wouldn't be easy to get working in a project with hundreds of resources...
f
The import opt will work! However, it's not always possible to modify the code, like in my case 🙂 Maybe I'm doing something unusual - I manage Route53 records with Pulumi, and the zone config is expressed in an YAML file (a file per zone actually), which is then read and interpreted by Pulumi. This way, I can write zone files in the most convenient and easiest way.
Does it sound like a good idea to be able to do something like: 1. User runs
pulumi up
and looks at the resources that are going to be created 2. The user knows the resources are already there and wants to just import them 3. They interactively mark them as "import only" 4. Or if they know in advance they want to import all, they can provide a regex for urns (to allow partial match) or several regexes via a flag. ?
Oh, this world is so small, you're from Wellington too! 🙂
l
Napier now, actually 🙂
🙌 1
I don't know of a way to import resources using static code. You need to edit the code to get importing working. I suppose if you were really confident, you could export the stack, update it, and import it again.. but I'm not recommending that...
f
I've actually used https://www.pulumi.com/docs/guides/adopting/import/#bulk-import-operations before, but it's not the most user-friendly. aws route53 list-resource-record-sets | some jq magic && pulumi import -f file.json But it's not the most user-friendly way. I wouldn't export/import the stack json, it's a rabbit hole 🙂