Debug a Policy
To understand what each rule is doing (whether written with a snippet or a custom rule), see the following options:
- Use the Preview button to provide a sample input and see if the output is what you expect. Notice that each rule optionally returns a message and helps you to identify which rules contribute to a final decision.
- Use the Preview button to provide a sample input and also select the Coverage option. Now, you will see which lines of Rego contributed to the overall decision you see in the output.
- View the underlying Rego by switching the policy editor to Code view, finding the card or code you are interested in, and clicking the blue highlighted line number.
note
The Rego code will be shown inline and includes an expansion arrow in the upper right corner that opens that Rego file full-screen in another browser tab.
- Modify the Rego by adding
print
statements, running the Preview option, and viewing the print output in the Print pane.
note
For more information on policy editing, see Write Policies.