Parsing an input file
Parsing Terraform files
Take, for example, the following Terraform file:
To get the equivalent JSON format, run the parse command:
This prints out the JSON, which you can use as guidance for writing your rules:
In Rego, accessing the node_type
field would look like this:
Parsing YAML files
Another example is the following YAML file, defining a Kubernetes resource:
To get the equivalent JSON format, run the parse command:
This prints out the JSON, which you can use as guidance for writing your rules:
In Rego, accessing the privileged
field would look like this:
Parsing Terraform Plan JSON output files
Another example is the following Terraform Plan JSON Output file, returned by the terraform show -json ./plan/example.json.tfplan
command:
To get the equivalent JSON format, run the parse command:
This prints out the JSON, which you can use as guidance for writing your rules:
In Rego, accessing the tags
field would look like this:
Last updated