I'm learning OPA and rego. I'm trying to write a simple policy and have the same evaluated through VSCode Plugin.
Folder Structure:
learning.rego
package learning
test {
a := "test"
a == "test"
}
input.json
{}
And when I choose "OPA: Evaluate Selection" option from the command pallete, I get the below error.
{
"errors": [
{
"message": "expected body but got *ast.Package"
}
],
"metrics": {
"timer_rego_load_bundles_ns": 919639,
"timer_rego_module_compile_ns": 481890,
"timer_rego_module_parse_ns": 55722,
"timer_rego_query_parse_ns": 22773
}
}
But the same policy is working as expected in rego playground and evaluates to "true" as expected. What am I missing here?