https://github.com/env0/env0-opa-plugin
env0 OPA plugin
https://github.com/env0/env0-opa-plugin
Last synced: 5 months ago
JSON representation
env0 OPA plugin
- Host: GitHub
- URL: https://github.com/env0/env0-opa-plugin
- Owner: env0
- License: mpl-2.0
- Created: 2022-12-01T19:20:40.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-18T12:06:17.000Z (over 3 years ago)
- Last Synced: 2025-11-16T23:27:35.465Z (7 months ago)
- Homepage: https://env0.com
- Size: 24.4 KB
- Stars: 0
- Watchers: 7
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# env0 OPA Plugin
This env0 OPA Plugin will allow you to run `opa eval` on a bundle directory as a part of your custom flow. To use this plugin, you will need to use version 2 of `env0.yml`.
Plugin is using OPA version `0.46.1`
## Inputs
The OPA plugin accepts the following inputs:
* path (required) - the path to your bundle directory (the root folder is your project's root folder)
* query (required) - a query to eval with `opa eval`
* flags - a string containing additional flags as one string
If you are used to using `--input` or `--data` you can bundle those into a bundle directory and use it. Read more about it [here](https://www.openpolicyagent.org/docs/latest/management-bundles/#bundle-build).
## Example Usage
In this example we will run `opa eval` with our own bundle file after the "Terraform Plan" step of a deploy. We will call that step "My Step Name":
```yaml
version: 2
deploy:
steps:
terraformPlan:
after:
- name: My Step Name # The name that will be presented in the UI for this step
use: https://github.com/env0/env0-opa-plugin
inputs:
path: bundle-file-path
flags: --fail --format=raw
query: data.example.violation[x]
```
## Further Reading
You can read more about the `eval` command and the available flags [here](https://www.openpolicyagent.org/docs/latest/#2-try-opa-eval).