Hi all! I am trying to construct a database connec...
# python
s
Hi all! I am trying to construct a database connection string and then store it as a secret. I have everything working apart from actually constructing the string correctly. I create databases, users, etc. and then try to construct this string:
Copy code
db_conn_etl = f"postgresql://{db_user_etl.name}:{db_user_etl.password}@{db_cluster.private_host}:{db_cluster.port}/{db_etl.name}"
In the secret, it shows up as
Copy code
postgresql://<pulumi.output.Output object at 0x7f3a0956c278>:<pulumi.output.Output object at 0x7f3a0956c128>@<pulumi.output.Output object at 0x7f3a095d2710>:<pulumi.output.Output object at 0x7f3a095d26a0>/<pulumi.output.Output object at 0x7f3a0956c390>
so obviously I'm missing something. How do I get the string value of each of those pulumi.output.Output objects? Going to keep digging but if anyone can help shorten my search, I'd greatly appreciate it 🙂
ah or this is even better
Copy code
# concat takes a list of args and concatenates all of them into a single output:
url = Output.concat("http://", hostname, ":", port, "/")
p
yep - basically, you can either use the output values directly or you have to use
apply
,
concat
functions if you want to manipulate it (even if it’s something little like adding dot at the end)
s
amazing! ty