late-journalist-61387
09/21/2023, 8:41 PMconst isPreview = pulumi.runtime.isDryRun();
if (!isPreview) {
rdsDataServer.endpoint.apply(rdsDataServerEndpoint => {
rdsDataServer.port.apply(rdsDataServerPort => {
....
// here we have received the rds host, user, password, ...
// now, we run the query to check if the user exist before
if(!userExistsDatabase("username"))
{
let secret = new aws.secretsmanager.Secret("...", {
// The name of the secret
name: "...",
tags: {
...
}
});
// create user in database with postgers library
// make an object to store the value
const storeKeyValue = {
dbUrl: ...,
}
// Setting a value for our secret
let secretValue = new aws.secretsmanager.SecretVersion("...", {
secretId: secret.id,
secretString: JSON.stringify(storeKeyValue),
});
}
}
}
it works well for the first time, however when I run the second time, as the user is created before and the secret creation code will not reach, pulumi tries to destroy that.
so what is the solution?No matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.
Powered by