with empty state and existing resources, and get that state synced up? I have an old stack where the state was stored locally in files that I haven't touched in a while. Now when I run
pulumi up
it connects to the cloud, sees no resources, and tries to create them all. But these resources exist and were previously created by Pulumi, so my thinking was that
pulumi refresh
should slurp them in. It doesn't, though, and always shows an empty modifications list. And
pulumi up
keeps offering to recreate everything. How do I import these resources into the cloud so I can keep managing them with Pulumi? Please tell me I don't have to import nearly 40 resources individually. 🙂
q
quick-house-41860
12/11/2024, 4:40 PM
I'm afraid, you'll need to import those resources.
You don't have to import them one-by-one though. You can run
pulumi preview
with the
--import-file
option to create an import file. That way you only have to fill in the IDs and can import all of them at once with
pulumi import --file ...
.
f
fresh-honey-15888
12/11/2024, 4:43 PM
Thanks, I have the import file. What sorts of values should I use for the placeholder in the ID?
q
quick-house-41860
12/11/2024, 4:45 PM
That depends on the resource/provider you're using. Commonly it's the primary identifier of the resource, but it can very from resource to resource.
Usually the docs of the resources have a
No matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.