any idea what causing this? i am using pulumi.rand...
# aws
v
any idea what causing this? i am using pulumi.random and the result of that is
DFpSfUijK8
Copy code
error: deleting urn:pulumi:dev::allrites-infrastructure::custom:component:rds:globaldb$aws:rds/cluster:Cluster::globaldb-cluster: 1 error occurred:
        * error deleting RDS Cluster (tf-20220812010823122500000001): InvalidParameterValue: The parameter DBClusterSnapshotIdentifier is not a valid identifier. Identifiers must begin with a letter; must contain only ASCII letters, digits, and hyphens; and must not end with a hyphen or contain two consecutive hyphens.
        status code: 400, request id: 92d6a0f5-2c7d-45d7-b094-bf9d91838c77
l
How are you using pulumi.random? Maybe you're using the Output as a string?
v
This is how i am using the random
Copy code
const finalSnapshotIdentifier = new random.RandomString("final-snapshot-identifier-random", {
   length: 10,
   special: false,
 }).result

----
{
  finalSnapshotIdentifier: config.get<string>('FINAL_SNAPSHOT_IDENTIFIER') || finalSnapshotIdentifier,
}
l
That's an interesting one. The type of that is
string || pulumi.Output<string>
which possibly isn't being resolved as a
pulumi.Output<string>
, so you're ending up with the error message (the one that says you cannot use an Output as a string) as the finalSnapshotIdentifier. To confirm / work around this, you could change the value to this:
Copy code
{
  finalSnapshotIdentifier: pulumi.output(config.get<string>('FINAL_SNAPSHOT_IDENTIFIER') || finalSnapshotIdentifier)
}
This will definitely be detected as a
pulumi.Output
, so it should sort itself out. If it doesn't, then the next thing to do is to look at the actual value by logging. Something along the lines of
Copy code
<http://pulumi.log.info|pulumi.log.info>(`Config value: ${config.get<string>('FINAL_SNAPSHOT_IDENTIFIER')}`);
<http://pulumi.log.info|pulumi.log.info>(("Random string", finalSnapshotIdentifier);
Note that you have to use the two-parameter version of pulumi.log.info() or else put that log statement inside an apply().
If the suggested workaround works, you could ask a Pulumi dev if your code should work. Maybe a GitHub issue should be raised.