Is there an example of wrapping strings as `pulumi...
# golang
g
Is there an example of wrapping strings as
pulumi.Secret
in golang? Do we have to use ApplyT to get convert the output to the right type?
g
Can you elaborate on what you're trying to do?
You can use
pulumi.ToSecret(value)
to wrap a string as secret - https://www.pulumi.com/docs/intro/concepts/secrets/#programmatically-creating-secrets.
g
Yeah, a couple of things: 1. Pass a secret obtained from an environment variable into a cloudformation resource as a cloudformation stack parameter. Currently passing this straight through without letting pulumi know it's a secret, b/c the type for
Parameters
is
pulumi.StringMapInput
2. Passing that same secret into a aws.secretsversion secretstring, via something like the key-value pairs example here https://www.pulumi.com/docs/reference/pkg/aws/secretsmanager/secretversion/#key-value-pairs (We're migrating away from cloudformation and envvars, I swear 😅 )
It's not obvious if it is worth converting that envvar secret to a pulumi secret for either of those cases to begin with. We're not printing anything to stdout, but I would rather not have it accidentally leak in case of a panic/error
g
I'm not entirely sure I'm following your points, but here's an example that I think describes what you're wanting. Does this answer your question?
g
myVarSecret.(pulumi.StringOutput)
That's the missing piece of the puzzle that I was looking for!! Thank you
👍 1