You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Add three adapters that allow pulumi.Output values to be used as inputs
to CDK resources:
- asString, which converts an Output to a string
- asNumber, which converts an Output to a number
- asList, which converts an Output to a string[]
Internally, this works by assigning each Output a unique numerical
identifier and creating an intrinsic Token with the value
`{ Ref: { PulumiOutput: <output id> } }`. The use of `Ref` is required
by the CFN validator, which otherwise errors if e.g. a value like
`{ "Pulumi::Output": <output id> }` is passed where a string is
expected.
There is likely more work to be done in the CFN -> Pulumi translator to
handle outputs embedded in strings, function calls, etc.
These changes also implement support for `DependsOn` in order to ensure
that the appsvc test passes reliably.
Fixes#3.
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.The text was updated successfully, but these errors were encountered: