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