Hi, I created a redis with `aws.elasticache.Replic...
# general
c
Hi, I created a redis with
aws.elasticache.ReplicationGroup
, it looks like the cluster name will be the
replicationGroupId
field value, which is not auto generated and a required field, because of this, when I changed the code, pulumi was unable to create the new resource first, because
Copy code
aws:elasticache:ReplicationGroup (dlv-sbx-redis-ch):
    error: Plan apply failed: Error creating Elasticache Replication Group: ReplicationGroupAlreadyExists: Replication group with specified name already exists.
        status code: 400, request id: 4db05f24-ecb5-11e8-9c78-b503b112c20a
Is it possible to let pulumi handle the naming in this case too? Or maybe the
deletetBeforeCreate
should be used
w
There are three options here. First, we should probably mark
replicationGroupId
as a "name" property so that it gets autonamed. Second, once https://github.com/pulumi/pulumi/issues/1620 is available (work in progress right now), you would have the option to add
deleteBeforeCreate
here to unblock. Third, and probably best right now - use the
@pulumi/random
package to create your own random id:
Copy code
let id = new random.RandomId('myid');
let storeGroup  = new aws.elasticache.ReplicationGroup(storeGroupName, {
  replicationGroupId: id,
});
That random ID will be generated once and stored in the checkpoint file between updates so that it will be the same across deployments of this stack, but different across different stacks.
c
and a new RandomId will be generated on replace?
w
Ahh - no, it will not - so that third option probably won’t solve your original problem. You can of course manually rename it whenever it needs to change - though that is not ideal and one or both of (1) and (2) above will be better solutions once they are available. Cc @microscopic-florist-22719.
c
thanks for the info Luke