https://pulumi.com logo
Title
n

numerous-artist-1705

07/02/2020, 4:40 PM
hi, does anyone use F# with Pulumi?
t

tall-librarian-49374

07/02/2020, 6:10 PM
several folks do. @wet-noon-14291 has been very active, also @shy-garage-48328 I believe
n

numerous-artist-1705

07/02/2020, 6:59 PM
Thanks. I wrote a library to use more idiomatic F# for Pulumi APIs. Computational expressions for resources and for the Output<T> monad. It made the code much cleaner and I would appreciate some feedback. I would also like to use code generators to auto-create CEs from Pulumi assemblies so it will not require high maintenance.
t

tall-librarian-49374

07/02/2020, 7:24 PM
Iā€™d love to take a look!
šŸ‘ 1
w

wet-noon-14291

07/02/2020, 7:29 PM
I was thinking about that, but decided to go for simpler helper functions while playing around. Mainly to make it easier for non native F# speakers to better understand since they would see the types as in the docs.
šŸ‘ 1
n

numerous-artist-1705

07/02/2020, 7:41 PM
hope it's OK to put the link here: https://github.com/UnoSD/Pulumi.FSharp.Azure
on the README.md there are example resources. it looks really clean compared to constructors + xxxArgs objects.
and using the
output {}
or
secretOutput {}
, you can avoid using
Output.Tuple
and a long chain of
Apply
with a nicer do notation. But I just added the resources I needed for another project so it misses basic stuff such as VMs, VNET, etc... I need to learn a bit of Myriad to avoid having to do the repetitive task of adding operations for all properties. I did what I could generalizing resourceGroup and names to a base type, but each resource has different properties so I end up repeating a lot of code for those and there is no way to avoid it without code generation.
E.G. to be able to support passing the resource group both as a name string, as an object an as an Output<>, I had to write 3+ overloads.
t

tall-librarian-49374

07/02/2020, 8:03 PM
If you ever want to generate the full API surface, this is the source that we use internally https://github.com/pulumi/pulumi-azure/blob/master/provider/cmd/pulumi-resource-azure/schema.json
As a bonus, Iā€™d likely get all non-Azure SDKs too
w

wet-noon-14291

07/02/2020, 8:21 PM
If you are interested I have my POC online https://github.com/mastoj/sweetspot. Not the most beautiful code in the world since Iā€™m just trying out different things at the same time :)
n

numerous-artist-1705

07/02/2020, 8:46 PM
thank you @tall-librarian-49374, I may look into that instead of using reflection over the types
thank you @wet-noon-14291 I will also explore your repository
w

wet-noon-14291

07/02/2020, 8:52 PM
Your CE looks really sweet.
n

numerous-artist-1705

07/03/2020, 5:25 AM
thanks šŸ™‚
w

wet-noon-14291

07/09/2020, 9:05 AM
@tall-librarian-49374 for the kubernetes part, is it this schema that is used to generate the types: https://raw.githubusercontent.com/pulumi/pulumi-kubernetes/master/provider/cmd/pulumi-resource-kubernetes/schema.json
t

tall-librarian-49374

07/09/2020, 9:05 AM
yes
šŸ‘ 1
n

numerous-artist-1705

07/09/2020, 9:31 AM
@tall-librarian-49374 thank you for the schema, that was really useful, I can already generate a builder from that for Virtual Machines, I'm trying to make it compatible with all resources now
t

tall-librarian-49374

07/09/2020, 9:33 AM
magic!
šŸ˜ 1
w

wet-noon-14291

07/10/2020, 6:58 AM
another question about the schema @tall-librarian-49374, it looks like the schema format is the same for both kubernetes and azure, just different content. Is that correct? If it is it shouldn't be too hard to use the same generator to generate CE for kubernetes as well.
t

tall-librarian-49374

07/10/2020, 7:17 AM
yes, the format is universal for all providers, current and future ones