Validate Terraform Online — HCL Syntax Checker

Live HCL syntax validation with line numbers. Syntax only — not terraform validate or provider checks.

Loading…
Terraform validator, syntax-only checker
Catch unclosed braces and malformed blocks while you edit HCL. It gives quick feedback before you run terraform validate in CI.

Developer notes

Validates HCL grammar only, not resource types, variable references or state. Live validation runs about 300 ms after you stop typing in the Monaco HCL editor. Empty input shows the idle state, not “invalid”. Parse errors highlight the line in the editor gutter and in the results panel. Use format-terraform after fixing syntax errors.

When teams pick this route

Sanity-check a pasted module fragment in a ticket or chat. Find the exact line of a brace typo without opening the IDE. Validate .tfvars-style HCL snippets that are not full modules. Teach HCL structure with immediate feedback.

Worked examples

Valid module skeleton (variable, data, resource, output)

Input

terraform { required_version = ">= 1.5.0" required_providers { aws = { source = "hashicorp/aws" version = "~> 5.0" } } } variable "region" { type = string default = "eu-west-1" } data "aws_ami" "amazon_linux" { most_recent = true owners = ["amazon"] } resource "aws_vpc" "main" { cidr_block = "10.0.0.0/16" } output "vpc_id" { value = aws_vpc.main.id }

Validation result

Valid HCL syntax, no errors. The result appears in the results panel.

Unclosed block (common copy-paste mistake)

Input

resource "aws_instance" "web" { ami = "ami-0c55b159cbfafe1f0" instance_type = "t3.micro" tags = { Name = "web"

Validation result

Invalid: parse error with the line number near the missing closing brace. The result appears in the results panel.

Navigate related DevOps tools

Format fixed HCL with format Terraform, or explore minify Terraform and the DevOps hub.

HCL validator FAQ

Syntax only

Same as terraform validate?

No, it checks HCL grammar only. Provider schemas and graph validation require the Terraform CLI.

Does it check .tfvars files?

Yes, if the content is valid HCL syntax. It does not evaluate variable values against modules.

Why debounced validation?

To avoid parsing on every keystroke while keeping feedback under ~500 ms after you pause typing.

Terraform HCL format/validate/minify, Dockerfile format & lint, Docker Compose and .env validation.