https://platformengineering.org logo
#terraform
Title
# terraform
m

Manolis

12/12/2022, 11:14 AM
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

Hutger Hauer

12/12/2022, 11:38 AM
@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

Manolis

12/12/2022, 11:58 AM
Cool, a YAML interface would be a nice way to achieve what I need, thank you.
j

Joseph Rajewski

12/12/2022, 3:20 PM
The developers… prefer YAML? 😅
m

Manolis

12/12/2022, 3:23 PM
To be honest they probably hate both 😛 But at least YAML is something they already know
a

Arie Heinrich

12/12/2022, 4:58 PM
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

Adarsh Shah

12/13/2022, 3:55 AM
@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

Fernando Villalba

12/13/2022, 12:07 PM
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

Arie Heinrich

12/13/2022, 12:12 PM
Mind you that creating a self service portal, doesnt equate going into the realm of Platform Engineering.
e

Erik Lundevall-Zara

12/13/2022, 4:58 PM
Have you looked at CDKTF? You can use it to interface through programming languages.
d

Daniel Serodio

12/21/2022, 10:14 PM
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

Fernando Villalba

12/21/2022, 10:29 PM
The example is in bullet points after that sentence, sorry for the confusion.
d

Daniel Serodio

12/21/2022, 10:30 PM
Thanks!
f

Fernando Villalba

12/21/2022, 10:30 PM
Can you see the submodules there?
d

Daniel Serodio

12/21/2022, 10:30 PM
Yes
I'll give it a detailed look, thanks for the fast reply
v

Vitor Costa

12/22/2022, 12:33 PM
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
86 Views