...

/

Validate a Terraform Configuration

Validate a Terraform Configuration

Learn how to validate a Terraform configuration.

Purpose

The terraform validate command is used to validate the syntax of Terraform files. Terraform performs a syntax check on all Terraform files in the directory specified and displays warnings and errors if any files contain invalid syntax.

This command doesn’t check formatting (like tabs, spaces, newlines, comments, and so on).

How to run validation

Validation can be run explicitly by using the terraform validate command or implicitly during the terraform plan or terraform apply commands. By default, terraform plan validates the configuration before generating an execution plan. If terraform apply is run without a saved execution ...