Replies: 1 comment 1 reply
-
Here's a simple example of the process. Let's say you have couple of policy files in your directory.
helper.rego package app.inputs
default allow = false
allow {
input.message == "hello"
} policy.rego package authz
import data.app.inputs
default allow = false
allow {
inputs.allow
} Now build your bundle:
Now evaluate bundle with some input. input.json {"message": "hello"}
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
This feels like such a simple thing but after hours of staring I need another set of eyes who is familiar with these tools.
As a single file, I am able to get policies to evaluate/execute; however, as I try to DRY up my code with bundles/imports things start breaking.
Goals:
What I've tried:
I've included the relevant imports into the target policy to the specific elements, but with both
opa
andconftest
I've hit a wall.Simplified version of what one of the imported packages looks like:
And the consuming policy references it via
import data.app.inputs.StadardInput
I would like to execute/test a policy with a bundle and defined input.
I've tried the following (names simplified):
opa exec -i input.json -d source_controls.rego -b .\bundle.tar.gz
exec
conftest test -p .\containsPolicyDirectory -d .\bundle.tar.gz --all-namespaces .input.json
opa eval -i input.json -d .\policy\source_controls.rego -b .\bundle.tar.gz --explain full
opa eval -i input.json -d .\policy\source_controls.rego -b .\bundle.tar.gz --stdin < .\source_controls.rego
Environment
I hope someone can point out a nice simple, flaw in what I'm doing that I can quickly address.
Beta Was this translation helpful? Give feedback.
All reactions