https://pulumi.com logo
#general
Title
# general
l

late-journalist-61387

09/21/2023, 10:26 PM
I am going to use postgress extension for pulumi to create role and extension, however this is my flow: 1. create a random string for user's password 2. create a new role 3. create a new secret manager to save it everything seems good, but the problem is that as the random value changes every time, it tries to replace role and secret manager value. what can I do?
b

billowy-army-68599

09/21/2023, 10:27 PM
how are you creating the random string?
l

late-journalist-61387

09/21/2023, 10:27 PM
using this typescript function
Copy code
export const generateRandomString = (length: number): string => {

    const characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';

    // rest of code remains the same
    let result = '';
    const charactersLength = characters.length;
    for (let i = 0; i < length; i++) {
        result += characters.charAt(Math.floor(Math.random() * charactersLength));
    }

    return result;
}
it is my own function
b

billowy-army-68599

09/21/2023, 10:30 PM
l

late-journalist-61387

09/21/2023, 10:31 PM
perfect, you have everything on your side...
I will try it, thank you