-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(opa): allow importing custom OPA modules in OPA policies #826
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very minor schema adjustment (I'll file an issue to integrate schema validation more natively) otherwise this looks good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. Appreciate the minor adjustments. Will get an additional set of eyes on this so that we can merge.
Love this! Shout out to the first PR I put up for Lula that was attempting to do this (your implementation is much nicer!) Pulled this down, tested, all lgtm, the only thing I might call out in the docs (or could probably be added in the code) is that |
Thanks! |
Sounds great, plus the doc point that zirain pointed out should cover that edge case. Thank you! Had another thought, and this certainly shouldn't block the current PR but more of a future point of expansion perhaps - if you are executing many validations that are all using the same common module it'll be repeatedly downloaded; might be nice to look at caching that data across validations somehow. Might add as a follow-on issue once this is merged 😄 |
I'd agree - I think we can look at accomplishing this from multiple levels. One is general file caching within Lula - or more appropriately how do we "package" everything for portability. The other is the module references which are not retained across validations. Feels like a few issues worth scoping separately. |
Signed-off-by: Ignasi Barrera <ignasi@tetrate.io>
Signed-off-by: Ignasi Barrera <nacx@apache.org>
Hi! I'm back and have addressed the review comments :) I agree caching would be great, but I'd like to keep that out of the scope of this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch on the reserved module name @meganwolf0
Description
This change allows importing existing OPA packages to be used in the main OPA policies.
In scenarios where several controls are implemented, it is desirable to have a way to define common functions that can be reused across them, to keep the main policies understandable and maintainable. OPA already provides a nice way of packaging modules, and this PR adds a
modules
configuration knob to the OPA provider to allow importing existing rego modules.Related Issue
N/A
Type of change
Checklist before merging