flaky-father-99093
01/07/2020, 1:28 AMapply
... but that doesn't seem to actually let me wind up with a string 🙂gentle-diamond-70147
01/07/2020, 1:31 AM.apply
directly to a resource input - e.g. userData
on an aws.ec2.Instance
.flaky-father-99093
01/07/2020, 1:35 AMapply
that seems to ever show up in that stringapply
, and then pass the resulting output (which will eventually resolve to what pulumi needs) to the userData?gentle-diamond-70147
01/07/2020, 1:56 AM.all(...).apply(...)
to combine multiple values into an interpolated string. Here's a contrived, but functional example:
const config = new pulumi.Config()
const mySecret = config.requireSecret("mySecret");
// create the string `vpc-abc123: asdf1234`
const userData = pulumi.all([vpc.id, mySecret]).apply(([vpcId, secret]) => `${vpcId}: ${secret}`);
// create the string `password: asdf1234`
const userData = pulumi.interpolate`password: ${mySecret}`
flaky-father-99093
01/07/2020, 3:58 AMstocky-spoon-28903
01/07/2020, 5:57 PM