Validation
April 29, 2026 ยท View on GitHub
The language server produces various types of diagnostics as you type.
HCL syntax
Starting in v0.8.0 we report diagnostics for invalid HCL syntax,
for example missing }, " or other "control characters" out of place.

HCL syntax alone does not account for the OpenTofu language with all its (in)valid keywords, block or attribute names etc. nor differences between OpenTofu versions, that is handled elsewhere.
Enhanced Validation
Starting in v0.32.0 we report additional diagnostics for selected invalid OpenTofu language constructs
based on detected OpenTofu version and provider versions (if available).
This validation is enabled by default but can be controlled via
validation.enableEnhancedValidation.
All validation rules currently implemented are considered universally applicable and not opinionated. If you believe a diagnostic is incorrect, this may be caused by mis-identified version of OpenTofu or provider version. See Provider Schemas for how the server picks a provider schema and how to recover from version mismatches. You can also temporarily disable validation and let us know by filing a new issue.
See supported rules below.
Module Files (*.tf)
Incorrect Number of Block Labels

Deprecated Attribute

Deprecated Block

Exceeded Maximum Number of Blocks
For blocks which have a maximum we check if the number was not exceeded.

Mising Required Blocks
For blocks which have an expected minimum we check if the number of blocks was met.

Missing Required Attribute

Unexpected Attribute

Unexpected Block

Reference to Undeclared Block or Attribute
This validation has a limited scope to variables (var.* / variable blocks)
and local values (local.* / locals) for now.

Variable Files (*.tfvars)
Unknown variable name
Each entry in the file is checked against its corresponding variable declaration
and entries without declaration are considered invalid.

Unexpected blocks
Blocks are not considered as valid in variable files.
