Hi, I'm confused about the usage of `properties` w...
# general
a
Hi, I'm confused about the usage of
properties
when doing a
pulumi import
. Let's say I have the following code:
Copy code
random.RandomPassword(example, length=3, special=False)
I also have a predefined string I want to use:
Copy code
abc
I can import the resource with:
Copy code
pulumi import random:index/randomPassword:RandomPassword example abc
The problem is that Pulumi wants to replace the resource, since
special
defaults to `true`:
Copy code
+-  ├─ random:index:RandomPassword        example                 replace     [diff: ~special]
Is there a way to tell Pulumi that the value of a property should be something else when importing? Thanks
d
a
I don't want to ignore changes in a resources property, I want to import a resource with that change already there.
Otherwise it's impossible to import certain resources and I don't think that's correct.
d
As the docs say, you use ignoreChanges for the first run after an import to avoid the recreation. The ignore can then be removed.
a
Ah, I see. It's a bit clunky, since I have a lot of resources like this, but it will work. Thanks!
Unfortunately this doesn't work for this resource. If you ignore the
special
property it won't do anything on the
pulumi up
d
It may require modifying the state directly. I'm not at a computer right now, so can't give guidance on it
I've opened this up as a feature request here: https://github.com/pulumi/pulumi-random/issues/480
a
Thanks!
Changing the state directly worked BTW
d
nice. I'd just done it locally with state to confirm it would work too