https://pulumi.com logo
#general
Title
# general
b

big-potato-91793

04/03/2020, 6:25 PM
Hey 👋 , I’m trying to contruct a config Record to pass to mustach to do the rendering of my config file.
Copy code
const configVariables: Record<string, string> = {
    username: config.databaseUsername,
    password: config.databasePassword,
    connectionString: config.databaseConnectionString,
    bucketname: config.bucketname,
    bucketPrefix: `${config.appName}/${config.environment}`,
    bucketRegion: config.region,
};
config.databaseUsername
is a secret. When I take a look at my secret in k8s the value is more something like
Copy code
"user": "Calling [toString] on an [Output<T>] is not supported.

To get the value of an Output<T> as an Output<string> consider either:
1: o.apply(v &#x3D;> &#x60;prefix${v}suffix&#x60;)
2: pulumi.interpolate &#x60;prefix${v}suffix&#x60;
What should I do? thx
w

white-balloon-205

04/04/2020, 4:35 AM
You will want to call mustache inside an apply. You will need to pass all of the Outputs you want to use in the mustache template to .all.apply - and then return the results of the mustache templating from the apply callback. The resulting output<string> you can pass as an input to some other resource. See e.g. https://www.pulumi.com/docs/intro/concepts/programming-model/#all.
b

big-potato-91793

04/04/2020, 11:22 AM
Thx Luke, I found that page and I made something that works now! Thanks