Hi, I have a problem in Pulumu I want to run some...
# general
l
Hi, I have a problem in Pulumu I want to run some conditional commands after the RDS server is created 1. I will check if I am not in preview mode 2. if the RDS is created, I get the ARN by using the apply 3. I will check if the user is not exist in the database, I will create it and make a secret code for that this is a part of code:
Copy code
const 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?