Hi, Is it possible in Go to execute a function at ...
# golang
m
Hi, Is it possible in Go to execute a function at runtime? I would like to create a resource, write some information of a resource to a local file, then package it up and use that package in another to be created resource. I see something like that is possible in Javascript with callbacks, but can't find anything for Go. Thanks
i
Sounds like something you could achieve using
Apply
https://www.pulumi.com/docs/intro/concepts/programming-model/#apply
m
Thanks for the nudge. Didn't think about Apply in this case, maybe I was looking for a different solution, but I guess it might work.
i
I think otherwise you’d need a dynamic provider, but that’s not yet supported for Go https://www.pulumi.com/docs/intro/concepts/programming-model/#dynamicproviders
m
Indeed using
pulumi.All(resource.attribute).ApplyT()
and inside the
ApplyT
writing it to a file works like a charm.
🎉 1
i
That’s great!