HCL Validator - Validate and Check Terraform Configuration Syntax Online
Free online HCL validator tool to validate, check, and verify Terraform/HCL configuration syntax with detailed error reporting and line numbers.
How to Validate HCL Configuration - Step by Step Guide
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:
Automatic Syntax Validation
A moment after you stop typing, the validator parses your HCL syntax and provides detailed feedback:
Review Validation Results
Get comprehensive feedback about your HCL configuration:
Fix Issues and Re-validate
Use the validation feedback to improve your configuration:
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.
Related Tools
HCL to JSON
Convert HashiCorp Configuration Language (Terraform) to JSON format
JSON to HCL
Convert JSON to HashiCorp Configuration Language for Terraform
HCL Formatter
Format and beautify HCL/Terraform configuration files with proper indentation
HCL Fixer
Fix broken HCL/Terraform files automatically, repair syntax errors, missing braces, and malformed blocks
HCL to YAML
Convert Terraform HCL configuration to YAML format
YAML to HCL
Convert YAML configuration to Terraform HCL format