magnificent-helicopter-3467
07/06/2022, 5:18 PMctx.RegisterResourceOutputs(<component>, resourceOutputsMap)
at the end of our component’s constructor but before the return, will this call ensure that all values in resourceOutputsMap
resolve before proceeding?
I don’t see anything visual during pulumi preview
in Outputs
when adding this call (just the usual exports). Any help in understanding this method would be appreciated, as I’m debating whether or not I should call it.billowy-army-68599
07/06/2022, 5:20 PMmagnificent-helicopter-3467
07/06/2022, 5:23 PMfunc NewMyComponent(ctx *pulumi.Context, name string, opts …pulumi.ResourceOption) (*MyComponent, error) {
// infos is a []pulumi.StringOutput in format "output_key1=output_value1;;;output_key2=output_value2…"
addInfoToOutputs(ctx, myComponent, infos)
return myComponent, nil
}
func addInfoToOutputs(ctx *pulumi.Context, myComponent *MyComponent, infos []pulumi.StringOutput) {
pulumi.All(infos).ApplyT(
func(args []interface{}) error {
var outputs pulumi.Map
for _, arg := range args {
s := strings.Split(arg.(string), ;;;)
for _, element := range s {
pair := strings.Split(element, "=")
if len(pair) != 2 {
return errors.New(fmt.Sprintf("Expected computed output pair to be of length 2, but got length %v", len(pair)))
}
outputs[pair[0]] = pulumi.String(pair[1])
}
}
err := ctx.RegisterResourceOutputs(myComponent, outputs)
if err != nil {
return err
}
return nil
},
)
}
billowy-army-68599
07/06/2022, 5:25 PMmagnificent-helicopter-3467
07/06/2022, 5:26 PMpulumi preview
letting me know that RegisterResourceOutputs
actually ran?billowy-army-68599
07/06/2022, 5:29 PMmagnificent-helicopter-3467
07/06/2022, 5:30 PMbillowy-army-68599
07/06/2022, 5:31 PM