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

gifted-balloon-26385

12/12/2023, 11:26 PM
Is there a way to update a property when using the
import
key? There are default resources present that I want to update, and since I know the ID ahead of time, I’m trying to do something like
Copy code
const resource = new pkg.Resource("thing", { ..., changedProperty: true }, { import: 'existing-resourceid' });
where
changedProperty
is the only property that’s different from what’s in the real state. but doing so gives me
inputs to import do not match the existing resource
is there any way to do this that doesn’t require removing the changed property, importing, and then updating afterwards (trying to not add a manual step to stack setup)
l

little-cartoon-10569

12/12/2023, 11:33 PM
No. This is a two-step process. You need to have your code match what's in the provider, when importing.
g

gifted-balloon-26385

12/12/2023, 11:38 PM
ack, thanks
l

little-cartoon-10569

12/13/2023, 12:08 AM
You also need to remove the import opt once it's imported, so that's the perfect time to put your code back to your real desired state.
c

cuddly-computer-18851

12/13/2023, 7:19 AM
It kind of makes pulumi untenable for importing any large scale infrastructure or project imho. You have to jump through so many hoops to reconcile state.
l

little-cartoon-10569

12/13/2023, 6:52 PM
Once, yes. It is the same when changing how you manage large numbers of resources. You can use
pulumi import
instead of the import id. If Pulumi imports the resources for you, they're put into state during the process, so you don't even have to remove the import opt.
But it's definitely easier to start off managing the resources.
2 Views