Oh nevermind, looks like I need to convert Output-...
# pulumi-cdk
s
Oh nevermind, looks like I need to convert Output->Token or Promise->Output->Token
Copy code
export declare type Input<T> = T | Promise<T> | OutputInstance<T>;
w
Yes - Pulumi fundamentally works with Outputs, and those are what can be mapped to and from tokens in the CDK bridge. Inputs are just a union that can be an Output<T> or T.
m
Had this same question myself today. The first thing I tried was passing the input to`asString()` — maybe that could accept inputs directly? That might be a bit more ergonomic than having to wrap the input in an output with
this.asOutput(pulumi.output(myInput))
. Happy to file an issue if y’all would agree with that.
w
Yes - that should be possible - and indeed would make this function a little more convenient to use. It's actually important that it not wrap the input in
pulumi.output
though, since that will result in an opaque token even for "known" values. It will need to type test the input and emit a plain old string value if it gets a
string
.
m
Ah I see, yeah that makes sense.