Fork me on GitHub
#aws
<
2020-05-18
>
mruzekw20:05:57

Is there a Terraform or CloudFormation of Clojure for AWS?

mruzekw20:05:17

I'm mainly thinking about the declarative nature of both, just with EDN

alidlorenzo22:05:54

@mruzekw As far as I know there isn’t any Clojure alternative to Terraform or Pulumi. I think many people just stick with json/yaml cloudformation templates. What I ended up doing is configuring cloudformation templates in EDN and wrapping Cognitect’s aws-api so that I could make requests to it via the repl (works well enough for me now and better than using aws console but YMMV) the repo is public in case you’d like to use/reference it: https://github.com/alidlo/infra.aws

alidlorenzo22:05:54

@mruzekw As far as I know there isn’t any Clojure alternative to Terraform or Pulumi. I think many people just stick with json/yaml cloudformation templates. What I ended up doing is configuring cloudformation templates in EDN and wrapping Cognitect’s aws-api so that I could make requests to it via the repl (works well enough for me now and better than using aws console but YMMV) the repo is public in case you’d like to use/reference it: https://github.com/alidlo/infra.aws

viesti11:05:04

This looks neat. While looking into Datomic Ions, I dabbled to make a yaml parser that understands the yaml tags for CFN intrinsics: https://github.com/portkey-cloud/cfn-yaml

viesti11:05:46

where this came from was that I could create API GW routes for the ions that are found in the resources/datomic/ion-config.edn

viesti11:05:30

I wanted to use the ion-config.edn as "source of truth", but had some yaml obstacles on the way, this kind of escalated 🙂

alidlorenzo18:05:39

what were the obstacles? I found that the aws-api made it easy to make* cloudformation requests, so as long as you don’t create some complex dsl, it’s just converting edn to json plus, reader literals make it easy to create some useful utilities that would have been otherwise difficult to do in json/yaml

mruzekw22:05:03

Wait, does aws-api create CloudFormation templates? I thought it was all imperative calls, albeit defined in a edn interface

alidlorenzo22:05:54

oh I meant make* cloudformation requests, not create. so you can configure templates in edn and then pass the options to :cloudformation client but as some others have mentioned might be less trouble using more robust code-as-infrastructure solution such as Pulumi

viesti15:05:28

maybe no real obstacle other than that I wanted to generate yaml, not json, in order to compare to CFN yaml templates I was using as an example. This offered a sidetrack for looking into yaml spec 😄

mruzekw04:05:10

Found this for writing Cloudformation templates https://github.com/brabster/crucible

viesti12:05:28

Nice, I have to have seen that before but have forgotten it, or then I just had not ran into it, swiss cheese memory :)

ghadi22:05:42

@mruzekw cdk-clj seems really nice https://github.com/StediInc/cdk-clj

ghadi22:05:53

there was a nice talk about it at the Conj

alidlorenzo22:05:48

the repo says they’re discontinuing maintenance in favor of using aws’s typescript sdk which is why i didn’t recommend it nor consider it myself as a viable option

ghadi22:05:41

Oh, didn’t realize.