Jam Notes #2: Terraform Templates

Contributions by Antoni Tzavelas and Darko Mesaroš

Welcome to our note series on our weekly Jam sessions, where we cover relevant DevOps topics with rotating guest speakers.

To save you time and energy, we’ll be uploading each Jam session topic’s notes, along with helpful tips.

For the week of May 5th, we covered Terraform templates (a theme that we’ve also covered in-depth in blog posts). We’ll go over what makes a good template, documentation best practices, and different strategies you can use to deploy Terraform templates.

Antoni Tzavelas (Google Certification Trainer) and Darko Mesaroš were our guest speakers on the topic.

Join our Slack to stay in the loop about our future weekly Jam Sessions on DevOps topics ranging from IaC to Terraform Templates.

1. What makes a good Terraform template?

  • It should be well-laid out, with comments to let you know what’s happening

2. What are common mistakes in Terraform templates?

  • Don’t put all your eggs in one basket by building a single Terraform template. Yes, it’s easier to write a single file, everything from a single repository for convenience, but if you make a mistake and you need to run the Terraform destroy command, you’ll take down the entire infrastructure (and end up taking down things you don’t want to)

3. What are Terraform templates best practices?

  • Apply modules when writing templates so you don’t put everything in one template

4. Who builds the Terraform templates in an organization and who customizes them?

  • Depending on the size of the organization, IaC is built, customized and maintained by small DevOps teams… (Think of the 2 pizza teams rule = individual teams shouldn’t be larger than what two pizzas can feed) to maintain a specific service

5. What are small to medium-size organization best practices?

  • Have a central repository where the code lives — people commit their code and know where to find, edit and deploy it. Could simply be a git repo

6. What are documentation best practices?

  • Any code you write should be readable

7. How can you make code understandable for non-technical people?

  • You don’t have to know code, you just need to learn how to read it

8. How do software developers who don’t know about cloud know how to use the Terraform templates?

  • You need to get educated on what the templates are for

9. What are strategies to deploy Terraform templates to different environments?

  • Apply the GitOps methodology → this is more of a developer mentality where you have your infrastructure configured in the background (templates and pipelines are all setup), you commit the code and things work in the background

Final pieces of advice:

Darko: Start using Infrastructure as Code, do it early and often

Antoni: 3 things to remember: Learn, Build, Document

— -
Did you find these tips on Terraform templates useful? We’ll continue posting our Jam session notes to provide you with up-to-date Terraform resources.

If you’re looking to try a new (free) tool to spin up your infrastructure easily, we recommend that you check out InfraSketch.

And, if you’re looking to get more Infrastructure as Code tips: join our Slack community to connect with other DevOps professionals.

PS: Did you know we have weekly Jam sessions on DevOps topics? The weekly invites go out on our Slack and Twitter channels. We hope to see you there!

Founder at InfraCode — customizable, reliable Infrastructure as Code tools. Simplifying the lives of DevOps professionals. www.infrastructurecode.io

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store