https://pulumi.com logo
#getting-started
Title
# getting-started
c

chilly-plastic-75584

03/29/2022, 11:23 PM
What's the proper way to set a value such as a sensitive database connection string as an exported value, yet it's a secret, so that it could be imported as a stack reference for another stack that needs to setup configs to this database. I'm using Go fyi.
b

billowy-army-68599

03/29/2022, 11:56 PM
if you mark it as a secret, it stays a secret through the flow. It'll be exported as
[secret]
and you'll need the encryption key to decrypt it
if you're using the pulumi service this is transparent, if you're using OSS backends it's...hard
l

little-cartoon-10569

03/29/2022, 11:57 PM
This is the page with the docs: https://www.pulumi.com/docs/intro/concepts/secrets/ The typescript code would be
export dbString = Output.secret(db.getPassword());
Looks like the golang equivalent is Output.ToSecret()? https://pkg.go.dev/github.com/pulumi/pulumi/sdk/v3/go/pulumi#ToSecret
c

chilly-plastic-75584

03/30/2022, 1:25 AM
Thanks I tried that but I need to check again. ToSecret didn't seem to match the current lifecycle, as export requires an input and such. I'll have at it again.
l

little-cartoon-10569

03/30/2022, 1:31 AM
Requires an input? It only requires an output in TS...
3 Views