Loading HCL Validator...
Please wait a moment

How to Validate HCL Configuration - Step by Step Guide

Step 1

Input Your HCL/Terraform Configuration

Start validating your HCL configuration by inputting it into the validator. Whether you're working with Terraform infrastructure code or HashiCorp configuration files, you have multiple ways to input your code:

•
Paste directly: Copy your Terraform configuration or HCL code and paste it into the input editor
•
Upload a file: Click "Upload" to pick a .tf, .hcl, .tfvars, .nomad or .txt file (up to 10 MB)
•
Try the sample: Click "Sample" to load example Terraform configuration and see how validation works
Step 2

Automatic Syntax Validation

A moment after you stop typing, the validator parses your HCL syntax and provides detailed feedback:

•
Syntax checking: Uses hashicorp/hcl, the parser Terraform itself uses, so unclosed blocks, broken strings, missing equals signs and duplicate arguments are all caught
•
Error location: Shows the line and column of the first problem, with the line itself and a marker under the spot
•
Configuration stats: Shows count of resources, variables, outputs, and data sources
•
Warnings: Flags resource, data, variable, output, module and provider blocks that have the wrong number of labels for Terraform
Step 3

Review Validation Results

Get comprehensive feedback about your HCL configuration:

•
Valid badge: Green badge confirms syntactically valid HCL
•
Error details: The first error, with its line and column and a plain-English explanation
•
Statistics dashboard: View counts of resources, variables, and other components
Step 4

Fix Issues and Re-validate

Use the validation feedback to improve your configuration:

•
Copy the error: Click "Copy" to put the error message, with its line and column, on your clipboard
•
Edit and re-validate: Make changes in the editor and see results update automatically
•
Format after validation: Use our HCL Formatter to beautify valid code

Frequently Asked Questions

What does the HCL validator check?

It runs your text through hashicorp/hcl, the same HCL parser Terraform uses, so anything it rejects would also fail when Terraform reads the file. That covers unclosed braces, strings and heredocs, missing or doubled equals signs, two arguments on one line, quoted argument names and an argument set twice in one block. The first problem is shown with its line and column and the line itself underneath. It also warns when a resource, data, variable, output, module or provider block has the wrong number of labels for Terraform.

Does this replace terraform validate?

No. This page only checks the syntax, in your browser. It knows nothing about providers, so a misspelled resource type, an unknown argument or a reference to a variable that does not exist will still pass here. Run terraform validate in your project for those checks; this page is for catching syntax mistakes quickly before you get that far.

Can I validate Terraform modules and state files?

You can check any HCL file from a module, such as main.tf, variables.tf or outputs.tf, one file at a time. State files (.tfstate) are JSON rather than HCL, so open those in the Terraform State Viewer instead.

What are the configuration statistics?

When the file is valid, you see how many lines it has and how many top-level resource, variable, output and data blocks it defines. Comments and text inside heredocs are not counted.

Is my Terraform configuration sent anywhere?

No. The parser runs in your browser, and nothing you paste or upload is sent to a server, so configurations that contain secrets stay on your machine.

Is the HCL validator free?

Yes, it is free and needs no account. Uploads can be up to 10 MB, and very large files may take a few seconds to check because everything happens in the browser.