Terraform Tips: My Favorite Tools

Jake Jones
FAUN — Developer Community 🐾
4 min readOct 21, 2020

--

My favorite tools to use in conjunction with Terraform.

Photo by Barn Images on Unsplash

TFSwitch

This is an amazing tool from Warrensbox which you can find on Warren’s website here or on the github repo here.

Tfswitch allows you to switch between different versions of Terraform on the fly. In addition to switching between Terraform versions tfswitch will download any version of Terraform you do not have installed if the version is selected.

Here are a couple of gifs from Warren’s github README that demonstrate how it is used.

To check out the tool and find more information on usage go check out the repo! Or just install it using this command:

brew install warrensbox/tap/tfswitch

Terraform-docs

Terraform-docs is an excellent tool for quickly creating a README.md for your terraform modules. You can find the github repository here.

All you have to do is change directory to your Terraform configuration files and run this command:

terraform-docs markdown ./

Then copy the output that will look something like this:

## RequirementsNo requirements.## Providers| Name | Version ||------|---------|| aws | n/a |## Inputs| Name | Description | Type | Default | Required ||------|-------------|------|---------|:--------:|| availability\_zone | Variable for AZ | `string` | `"us-east-1a"` | no |## OutputsNo output.

Paste this output into a README.md file for your module. Then you will have a beautiful markdown file in github that looks like this:

On to the next tool!

Visual Studio Code Extensions

For a multitude of reasons I switched from using Sublime Text to using Visual Studio Code. That is a topic for another article, but just know I found VS Code to be FAR superior.

Here are some of the extensions I found to be helpful for writing Terraform code.

Bracket Pair Colorizer 2

Bracket pair colorizer highlights your brackets and helps you to make sure your syntax is correct. Missing a bracket? It will help point that out as well! Here is what it looks like:

HashiCorp Terraform

This probably goes without saying, but I use HashiCorp Terraform to highlight the terraform syntax and verify that my code looks correct. Here is some code that looks good:

Here is some that looks bad:

It won’t solve your syntax problems for you, of course. Definitely helps find them though!

Terraform Autocomplete

This is an autocomplete tool for Terraform. It will just make simple suggestions on how to complete naming and give example usage. This is what it looks like in use:

You just hit tab to perform the completion and it will take care of inputting the example usage. Really helpful as a reminder for our falliable brains.

Conclusion

That is it! Those are my most used and recommended tools for Terraform. There are definitely PLENTY more out there, but these are the tools I find most useful today.

I hope you enjoyed this and found it helpful! If you are interested in learning more about Terraform I have a Free Terraform Course for getting started and a course to help you study for your HashiCorp Certified: Terraform Associate.

I also highly suggest checking out Terraform Up & Running by Yevgeniy Brikman.

Happy learning!

👋 Join FAUN today and receive similar stories each week in your inbox! Get your weekly dose of the must-read tech stories, news, and tutorials.

Follow us on Twitter 🐦 and Facebook 👥 and Instagram 📷 and join our Facebook and Linkedin Groups 💬

If this post was helpful, please click the clap 👏 button below a few times to show your support for the author! ⬇

--

--