DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
View Events Video Library
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Migrate, Modernize and Build Java Web Apps on Azure: This live workshop will cover methods to enhance Java application development workflow.

Modern Digital Website Security: Prepare to face any form of malicious web activity and enable your sites to optimally serve your customers.

Kubernetes in the Enterprise: The latest expert insights on scaling, serverless, Kubernetes-powered AI, cluster security, FinOps, and more.

A Guide to Continuous Integration and Deployment: Learn the fundamentals and understand the use of CI/CD in your apps.

Related

  • How TIBCO Is Evolving Its Platform To Embrace Developers and Simplify Cloud Integration
  • Infrastructure as Code: Exploring Terraform's Dominance
  • Infrastructure as Code (IaC) Tools, Part 1: Overview of Tools
  • IDE Changing as Fast as Cloud Native

Trending

  • Unveiling the Application Modernization Roadmap: A Swift and Secure Journey to the Cloud
  • A Comprehensive Guide to Cloud Monitoring Tools: Ensuring Optimal Performance and Security
  • Enhancing Observability With AI/ML
  • Architecture Approach: Domain-Driven Design (DDD)
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. Must-Have Infrastructure as Code Tools

Must-Have Infrastructure as Code Tools

A small set of tools to make your Terraform coding journey smoother. Tools to Lint, visualize, document, and clean your Terraform HCL2 code.

Vidyasagar (Sarath Chandra) Machupalli user avatar by
Vidyasagar (Sarath Chandra) Machupalli
DZone Core CORE ·
Jul. 03, 23 · Opinion
Like (3)
Save
Tweet
Share
3.6K Views

Join the DZone community and get the full member experience.

Join For Free

Here are some handy tools that made my Terraform coding journey smoother and should help your Terraform coding as well.

What Is Terraform?

For starters, Terraform is an infrastructure as a code (IaC) tool that helps you provision Cloud or On-premise resources through declarative configuration. Terraform uses HCL2 (Hashicorp Configuration Language).

HCL2 = HCL1 + HIL (Hashicorp Interpolation Language)

Check this GitHub repository to learn more about HIL.

Use Different Terraform Versions

If you are familiar with the Node.js world, different projects require different versions. So, I use nvm(node version manager). Similarly, in our Terraform world, there are tfswitch and tfenv to use different versions of Terraform for different projects or for testing your Terraform project with different versions of Terraform.

  • TFSwitch
  • tfenv

tfswitch showing Terraform versions

Visualize Terraform

It helps to visualize your Terraform resources, modules, etc., to understand the flow and the connections.

I published an article that talks about various visualization tools associated with Terraform. It includes the inbuilt terraform graph. 

Code Formatting, Code Navigation, Syntax Highlighting

You can always run Terraform commands to format and validate your HCL2 code like this: 

terraform fmt
terraform validate


Running these commands on a project with a complex folder structure becomes tiresome, as there can be multiple directories with *.tf files.

  1. Visual Studio Code Extension to the rescue.

Visual Studio Code Extension

Hashicorp Terraform extension for Visual Studio Code

2. Language Server

Terraform Language server is the official language server created and maintained by the creators of Terraform that provides IDE support.

Add support for the Terraform configuration language to editors that use the Language Server Protocol, like Sublime Text, vim, emacs, etc.
- Hashicorp

3. Terraform by Anton

This is a Visual Studio Code extension. Adds syntax support for the Terraform and Terragrunt configuration language.

Documentation

Terraform-docs generates documentation for Terraform modules in multiple formats. The tool lists modules, resources, inputs, outputs, providers, data resources, etc., The tool provides --recursive flag to update submodules recursively.

Sample commands showing the markdown format

terraform-docs markdown . >>README.md
terraform-docs markdown table .


Check a sample markdown file generated using Terraform-docs. The Terraform is associated with this article.

As developers, we have a habit of forgetting things. Cleaning the code is one of the most important thing that we always forget. Terraform cleaner to the rescue.

Terraform Cleaner

Terraform Cleaner is a tool to detect Unused Variables and Locals in Your Modules. You can find the complete documentation in the article "Terraform Cleaner — A Tool to Detect Unused Variables and Locals in Your Modules."

Additional Tools

Heard about terraform console command? How many times as developers would we have thought of evaluating a list of objects or any other expression without running terraform plan or terraform apply commands? The terraform console command helps you to evaluate and experiment with expressions on a terminal or command prompt. You can experiment with built-in terraform functions like slice, split, cat, etc., even before incorporating them into your HCL2 code.

Additionally, you can check other tools for security and compliance, validation, automation, etc., on the official Hashicorp documentation.

Also available are tools from the awesome-terraform GitHub repository.

Integrated development environment Visual Studio Code Terraform (software) Infrastructure as code

Published at DZone with permission of Vidyasagar (Sarath Chandra) Machupalli, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • How TIBCO Is Evolving Its Platform To Embrace Developers and Simplify Cloud Integration
  • Infrastructure as Code: Exploring Terraform's Dominance
  • Infrastructure as Code (IaC) Tools, Part 1: Overview of Tools
  • IDE Changing as Fast as Cloud Native

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: