You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Importing specific rule from module is not supported – dependencies fail to resolve and konstraint create fails.
For example, having import lib.core.missing_field in policy should resolve that to "import missing_field from lib.core" instead of "import missing_field from lib/core/missing_field.rego" and failing.
The text was updated successfully, but these errors were encountered:
Thanks for raising this. Using the import keyword in this manner isn't very common in the Rego policies I've seen. Given that the import keyword is only an alias and does not affect the scope of what is loaded or the runtime performance, it seems a reasonable work-around for now is to import the entire package and then invoke the rules using the package prefix ex core.missing_field() rather than missing_field().
If you have the time, I'd be happy to review a PR. If you plan on working on this please assign the issue to yourself so we don't duplicate any effort.
@jalseth I've seen it being used in Gatekeeper examples and Gatekeeper policy library iirc
I'm not sure on what'd be the best way to implement this, so I probably won't be submitting PR for this issue for now.
Importing specific rule from module is not supported – dependencies fail to resolve and
konstraint create
fails.For example, having
import lib.core.missing_field
in policy should resolve that to "import missing_field from lib.core" instead of "import missing_field from lib/core/missing_field.rego" and failing.The text was updated successfully, but these errors were encountered: