famous-bear-66383
06/18/2020, 2:41 PMpulumi.Output<string>
to a string
?
given
const pass = new random.RandomPassword("password", { length: 20, special: true },{additionalSecretOutputs: ["password"]}).result;
I want to use pass
as a string to set other resources.
const dbuser = new gcp.sql.User(`${user}-database-user`, {
instance: instanceName,
name: user,
password: pass.apply(p => p.toString()),
host: "cloudsqlproxy~%"
});
using apply
like the following throughs errors
pass.apply(p => p.toString()
rich-napkin-40911
06/18/2020, 2:44 PMapply
work; something like
const dbuser = new gcp.sqlUser('...', {
// ...,
name: pulumi.interpolate`${name}`,
});
famous-bear-66383
06/18/2020, 3:03 PMArgument of type 'Output<string>' is not assignable to parameter of type 'string
interpolate
returns Output<string>
so it doesn’t really solve my issuerich-napkin-40911
06/18/2020, 3:08 PMOutput<string>
as input... 🤔faint-table-42725
06/18/2020, 3:47 PMpassword: pass
— did you get an error doing that?famous-bear-66383
06/18/2020, 7:40 PMexport function AddDBUser(user: string, pass: string, instanceName: string){
return new gcp.sql.User(`${user}-database-user`, {
instance: instanceName,
name: user,
password: pass,
});
}
The error was coming from that function.
once I changed the arguments to pulumi.Input<string>
it worked.faint-table-42725
06/18/2020, 10:03 PM