#terraform
How do you handle the module abstraction so the de...
m
How do you handle the module abstraction so the developers don't have to write
.hcl
code? I have used terragrunt in the past so developers only had to provide some inputs using the provided modules but I want to find some better alternatives too.
h
@Manolis, I used to make use of tfvars to provide an easier interface for Devs. However, for some use cases I’m making use of YAML definition files. The Devs are required to declare the resources in YAML format and all the complexity behind is abstracted.
m
Cool, a YAML interface would be a nice way to achieve what I need, thank you.
j
The developers… prefer YAML? 😅
m
To be honest they probably hate both 😛 But at least YAML is something they already know
a
You dont even need YAML, you need just a storage like a key value database. Create a webpage that collects values of certain fields into a key-va;ue db and then have a process that reads the values and acts upon them. This will allow you to implement some logic into the value fields and of course governance and security so you dont have to even give them access to the pipelines. Just query them when its done and present a message in the UI or a message into your slack / teams channels.
a
@Manolis We have an open source project that has a YAML abstraction over terraform & also environment blueprints that might be of interest to you.. https://github.com/cloudknit-io/cloudknit
and here is our architecture diagram that explains the flow: https://docs.cloudknit.io/concepts/architectural_overview/
f
I've written at length how to create modules that are like "apps" here if it helps any: https://www.contino.io/insights/terraform-best-practices
That's if you want to keep sticking to Terraform. If you want to go into the realm of Platform Engineering, I'd advise tools like Humanitec, Crossplane or Kubevela to be able to create resources more dynamically. Disclaimer: I work for Humanitec, so of course I'll be slightly biased to recommend that, but there may be other tools that fit your needs easier, better or cheaper like the others I mentioned - it really depends on your needs.
a
Mind you that creating a self service portal, doesnt equate going into the realm of Platform Engineering.
e
Have you looked at CDKTF? You can use it to interface through programming languages.
d
Great article @Fernando Villalba, thanks for sharing it! However, I think there's a missing link where it says "Here is an example of a repository that uses submodules by Google that you can use as reference". I couldn't find the mentioned example repo
f
The example is in bullet points after that sentence, sorry for the confusion.
d
Thanks!
f
Can you see the submodules there?
d
Yes
I'll give it a detailed look, thanks for the fast reply
v
I found this project called Gaia, which creates a UI for your Terraform modules and even runs the
plan
and
apply
for you. I've never used it, but it looks nice. When you give developers a YAML or HCL, at least you keep all variables values as code, but I am not sure if Gaia does it or if it just relies on managing it using the tfstate files