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 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:
### Requirements
No requirements.
### Providers
| Name | Version |
|------|---------|
| aws | n/a |
### Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| availability\_zone | Variable for AZ | `string` | `"us-east-1a"` | no |
### Outputs
No 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!
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 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:
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!
#hashicorp-terraform #coding #devops #terraform #infrastructure-as-code