any idea what causing this? i am using pulumi.rand...
# aws
any idea what causing this? i am using pulumi.random and the result of that is
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
How are you using pulumi.random? Maybe you're using the Output as a string?
This is how i am using the random
Copy code
const finalSnapshotIdentifier = new random.RandomString("final-snapshot-identifier-random", {
   length: 10,
   special: false,

  finalSnapshotIdentifier: config.get<string>('FINAL_SNAPSHOT_IDENTIFIER') || finalSnapshotIdentifier,
That's an interesting one. The type of that is
string || pulumi.Output<string>
which possibly isn't being resolved as a
, 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
, 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
<|>(`Config value: ${config.get<string>('FINAL_SNAPSHOT_IDENTIFIER')}`);
<|>(("Random string", finalSnapshotIdentifier);
Note that you have to use the two-parameter version of 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.