open-policy-agent / vscode-opa

An extension for VS Code which provides support for OPA and the Rego policy language
https://openpolicyagent.org
Apache License 2.0
112 stars 31 forks source link

Add rego policy validation for yaml files while editing yamls or as a static policy validation #308

Open mrgadgil opened 21 hours ago

mrgadgil commented 21 hours ago

Usecase: Have policy written in rego Input format : yaml Run the opa policy engine against the yaml files as linter similar to a schema validator. This would make the policy validation intuitive for vscode users.

I also noticed that the opa evaluate commands so not support yaml and need the file name to be input.json

charlieegan3 commented 8 hours ago

Hey @mrgadgil, thanks for filing the issue and for stopping by the kiosk at kubecon. I think this feature makes sense. I am unsure how best to implement it, one idea I had would be to add another language server to the extension that could read rego files and use the currently open file as input to the rego policy in the same repo. However, we'd need a means to map input files to the relevant policies.

Can you share some examples of the IBM cloud yamls you're working on and the policies you want to use to 'lint' them?