Coding Guide Spotlight: Terraform Best Practices

Sema
3 min readJun 30, 2022

--

In this occasional series, Sema highlights strong coding practices created by practitioners– style guides, best practices, and advice on algorithms and data structures.

Hey Terraform Fans!

Anton Babenko, an AWS Community Hero and self-proclaimed Terraform fanatic, has put together an awesome guide to Terraform best practices and he is maintaining a lot of Terraform projects listed here — https://github.com/antonbabenko/terraform-aws-devops

As Anton wrote in his introduction:

Terraform is powerful (if not the most powerful out there now) and one of the most used tools which allow management of infrastructure as code. It allows developers to do a lot of things and does not restrict them from doing things in ways that will be hard to support or integrate with.

The book was started in sunny Madrid in 2018, available for free here at https://www.terraform-best-practices.com/.

A few years later it has been updated with more actual best practices available with Terraform 1.0. Eventually, this book should contain most of the indisputable best practices and recommendations for Terraform users.

It is sponsored by cluster.dev and coder.com. Thank you for your support.

How did the author get into tech?

I was curious about programming and math since 7 y.o. when I got ZX Spectrum. Later I discovered the web and spent almost 15 years doing web-development which led me to the open-source world which I enjoyed since day one.

Why did the author decide to build the guide?

As I was practicing Terraform and teaching it to different companies over years, I saw what worked and what didn’t. Also, seeing a lot of open-source projects formed my vision of how to work efficiently with IaC and Terraform. I also don’t like saying “it depends” if it should not really depend. There are some good and some bad practices in existence. I wanted to focus on what actually works for me, many of my customers, and in a vast of open-source projects.

What are some of the benefits of the guide the author is particularly proud of?

Several companies (well-known public and startups) are linking to this guide from their internal wikis and implementing practices described there by default instead of spending time reinventing the wheel.

This guide is rather popular, so it is already translated into 8 languages with 6 more still in progress.

What do we like about the guide?

  • Great, clear structure, and easily searchable
  • Multiple languages — English, Spanish, French, German, Indonesian, Portuguese, Polish, and Ukrainian, 6 more in progress
  • Code structures in easy-to-read charts, plus code styling, and more

Sample: Resource and data source arguments

Want to learn more?

Want to help?

We are always looking for more more translations. If you want to translate it to your language, just send me an email (anton@antonbabenko.com) or DM in twitter ‍(@antonbabenko)

Using this Guide in Code Reviews

Sema has built a free code review assistant and developer portfolio tool for GitHub. You can easily access Terraform Best Practices and over 700 other guides while you do code reviews.

Sign up for free at https://www.semasoftware.com/

--

--

Sema
Sema

No responses yet