pulumi / pulumi-random

A Pulumi provider that safely enables randomness for resources

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Import with different parameters

antdking opened this issue Β· comments

Hello!

  • Vote on this issue by adding a πŸ‘ reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

Issue details

Currently, it's possible to import a RandomPassword with the below command (as documented):

pulumi import random:index/randomPassword:RandomPassword newPassword supersecret

which will generate the below code:

new_password = random.RandomPassword("newPassword",
    length=11,
    lower=True,
    number=True,
    numeric=True,
    special=True,
    upper=True,
    opts=pulumi.ResourceOptions(protect=True))

It isn't possible, however, to import with different parameters, such as with special=False.

Terraform provides a work-around by use of ignore_changes, where you can temporarily mark a parameter as ignored while you change it, then remove the ignore afterwards.
This doesn't work in Pulumi, as the input remains unchanged in state when the parameter is ignored.

This means making the change isn't possible without either losing the value, or manually modifying the state:

    numeric=True,
-    special=True,
+    special=False,
    upper=True,

The example above uses RandomPassword, however it's assumed this also impacts RandomString as well.

Originally raised in Slack

Affected area/feature

This is likely the same problem as #312, however I've opted to open a new issue as the OP was unresponsive.
This also makes it a feature request, as it's a limitation as opposed to a bug.