blast-hardcheese / dhall-terraform

Tooling to manage complexity and increase discoverability in Terraform by writing in Dhall.
MIT License
44 stars 1 forks source link

Example of using Dhall to generate terraform file to manage a Github Organisation #2

Open etaty opened 5 years ago

etaty commented 5 years ago

Hi,

No treally an issue, but I have created an example of using Dhall to generate terraform file to manage a Github Organisation. https://github.com/etaty/example-dhall-terraform-github

The Dhall community is small, so I thought sharing it here would be a good idea. Also thanks for creating this repo, it helped me get started to use Dhall with Terraform 👍

blast-hardcheese commented 5 years ago

Excellent! I'm glad you found it helpful 😄

One of the challenges I ran into was that earlier versions of the Dhall compiler were extremely slow (~1 minute to evaluate the interface I've described for datadog, for example).

I still believe that the right thing to do is to describe the API with as much rigor as possible, (very few primitive fields, choosing to express Text as an enumeration with smart constructors) with the hope that the compiler will get even faster, and that tooling will get better as well.

I'm still working on DataDog support in the datadog-provider branch, and I'm generally hoping to carve out support for at least the subset of the Terraform providers that people in the Dhall community actually care to use.

I will say, there's one major downside of the approach I'm taking, at least currently, which is the verbosity of abstractions that are necessary to provide explicitly, as the definitions are done without explicitly writing a dhall-terraform tool that integrates with dhall-haskell. This is done because I suspect it would be much more fruitful to implement (or cross-compile) a Dhall compiler in Go, then implement .tf.dhall directly in Terraform itself. Once that work is done, I expect most of the abstractions I am attempting to build here will map to that new platform without too much difficulty. Unfortunately, I have no interest in Go, nor do I currently feel as though I would be able to contribute to the Terraform codebase in a way that would conform to idiomatic Go, thus doing more harm than good.

If you'd like to contribute to the set of definitions in this repository, I'd gladly welcome PRs! Especially right now, I think consolidation in distinct implementation strategies will be helpful as the community grows.