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.
Examples
Validate the syntax of all policies in the current directory:
$ tfpolicy validate --policies=.
Validate the syntax of all policies in the specified directory:
$ tfpolicy validate --policies=./policies
Example Output
$ tfpolicy validate --policies=.
Success! Terraform policies validated successfully.
Available options
You can include the following flags when you run the tfpolicy validate command:
| 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" | None | No |