I got my pulumi stack python code working to creat...
# getting-started
a
I got my pulumi stack python code working to create resources, one of which is a random_password. This works fine if pulumi creates the stack. I now need to import existing resources including existing password. My resource is created with these options
Copy code
resource_args = pulumi_random.RandomPasswordArgs(
            length=64,
            lower=True,
            upper=True,
            numeric=True,
            special=False,
            min_lower=0,
            min_upper=0,
            min_numeric=0,
        )
I am trying to import either via CLI or import json an existing password using
Copy code
CLI:
 pulumi import "random:index/randomPassword:RandomPassword" "db0/password" "RU5hBS4PZg0lhvUEUCKj4ZJhVBirVSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
JSON:
    {
      "type": "random:index/randomPassword:RandomPassword",
      "name": "db0/password",
      "id": "RU5hBS4PZg0lhvUEUCKj4ZJhVBirVSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
      "provider": "app_platform_random"
    },
The resource is imported but the special flag is True so the next up causes it to generate a new password. How do I import with the correct properties?
l
Since you're setting the property in the constructor, the imported resource should have the same property value, or else fail to import. That's the documented behaviour. If the provider isn't doing that, it's probably a faulty implementation. Maybe raise an issue in the random provider's GitHub repo? To work around it in the short term, you could import it then change the state manually, or set the ignoreChanges opt for that property.
a
My current work around is to tweak the state file manually. That works but... good thing its only on import.