Is there a way to update a property when using the...
# general
g
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
No. This is a two-step process. You need to have your code match what's in the provider, when importing.
g
ack, thanks
l
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
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
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.