Is it possible to write custom terraform functions?
If yes, how to write them?
Tryied this tutorial but is there no mention of custom terraform functions.
3
Yes you can develop custom Terraform functions, but it requires a recent version of the Terraform Plugin SDK (if the functions are developed in Go), and Terraform version >= 1.8. If you want to develop the functions in a language other than Go, then you would need to reproduce plugin SDK functionality (which would be onerous). The documentation contains more details.
If you want to develop the functions in a language other than Go, and are content with the functionality being very similar, but not literally a custom function, then you would want the external data source. You can provide JSON format inputs to and return JSON format outputs from an arbitrary executable in a given language.