This message was deleted.
# getting-started
s
This message was deleted.
w
Once you create a DO Database Cluster, the return value will contain “Output” fields which include the database’s credentials. You can pass those Outputs into other resources as Inputs. For example, if you wanted to take an Output and run “psql”, you might use the Command provider, which lets you run a local executable. You can provide the credentials Output from DO as arguments. After the cluster is created, the Command will run with the database credentials.
m
Yea, I get that but they both kinda start at the same time. Have any sample ts/js code I can take a look at?
My code:
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";
const cravin_db = new digitalocean.DatabaseCluster("ifc-cravin-database", {
engine: "mysql",
nodeCount: 1,
region: "blr1",
size: "db-s-1vcpu-1gb",
version: "8",
name: "ifc-cravin-database"
});
const cravin_server = new <http://digitalocean.App|digitalocean.App>("ifc-cravin", {spec: {
name: "ifc-cravin-server",
region: "blr1",
services: [{
github: {
branch: "main",
deployOnPush: true,
repo: "Anan7Codes*/repo*",
},
instanceCount: 1,
instanceSizeSlug: "professional-xs",
name: "ifc-cravin-server",
buildCommand: "npm run -w api build",
runCommand: "npm start -w api",
envs: [
{
key: "DB_URL",
`value: `mysql://doadmin:${cravin_db.password}@${cravin_db.host}:${cravin_db.port}/defaultdb?sslmode=no-verify``
}
]
}],
}});
Managed to sort this out using the dependOn method but the credentials from db aren't being passed to the DB_URL.