tfpolicy validate
The tfpolicy validate command validates the syntax of your policy files.
Usage
$ tfpolicy validate --policies=</path/to/policies>
Description
Once you have written your .policytest.hcl file, validate their syntax with the tfpolicy validate command. Similar to the terraform validate command, tfpolicy validate reports whether your policies are syntactically valid and internally consistent.
Available options
The tfpolicy validate command supports the following options.
| Option | Description | Default | Required |
|---|---|---|---|
--policies=</path/to/policies> | Validate the syntax of all policies found in the specified path. | Current directory | No |
--evaluation-stage=<stage> | Validate policies for the specified evaluation stage: "setup" or "plan". | "plan" | No |
Examples
The following examples demonstrate the tfpolicy validate command.
Basic usage
Validate the syntax of all policies in the current directory:
$ tfpolicy validate --policies=.
Success! Terraform policies validated successfully.
Validate the syntax of all policies in the specified directory:
$ tfpolicy validate --policies=./policies