pulumi/pulumi-cdk

[cdk] Allow users to easily consume Pulumi Outputs and Resources within a CDK context without the use of apply

pgavlin opened this issue · 0 comments

In order to provide an easy-to-use experience for the CDK bridge, we need to allow users to easily consume Pulumi Outputs and Resources from within a CDK context without wrapping entire CDK fragments in an apply. I believe that we can do this by authoring an implementation of IResolvable that resolves outputs to some CFN-compatible representation and presenting a user-facing API that allows for the conversion of Outputs to string-encoded CDK tokens. For example, we could offer a method pulumi-cdk.toString(o: Output): string that assigns the output a unique ID, records the mapping in some internal table, creates an appropriate IResolvable, and returns the result of token.asString. The IResolvable could then resolve the encoded token to something like { “Pulumi::Output”: } in the CFN template, which would allow us to map back to the output value itself when interpreting the CFN. I believe that a similar solution would work for resources.