OPA (Open Policy Agent) Compile

OPA (Open Policy Agent) Compile

Certified
Enterprise Edition

Partially compile an OPA policy

Uses the OPA Compile API to partially evaluate a Rego query, returning residual queries. Metrics and explain outputs are optional and disabled by default.

yaml
type: io.kestra.plugin.ee.opa.policy.Compile

Compile an OPA policy (partial evaluation)

yaml
id: compile_policy
namespace: company.team

tasks:
  - id: compile_policy
    type: io.kestra.plugin.ee.opa.policy.Compile
    url: "{{ secret('OPA_URL') }}"
    token: "{{ secret('OPA_TOKEN') }}"
    query: "data.authz.allow == true"
    input:
      user:
        role: "analyst"
        department: "finance"
    unknowns:
      - "data.records"
    options:
      disableInlining: []
    metrics: true
Properties

Rego query to compile

Rego query to partially evaluate (e.g., data.policy.allow == true).

OPA base URL

Assets this task consumes as inputs or produces as outputs, for lineage tracking and the asset graph (Enterprise Edition). A flow declaring this property on a task is rejected in the open-source edition.

Definitions
assetFailureBehaviorstring
Possible Values
IGNOREFAILWARN

Asset failure behavior

Behavior applied to the task state when a declared asset fails to render, emit, or be persisted (e.g. a lock conflict): FAIL escalates it to FAILED, WARN (default) warns it if it would otherwise succeed, IGNORE leaves the state untouched.

enableAutobooleanstring

Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.

inputsarray

The assets consumed as inputs.

id*string
Min length1
typestring
outputs

The assets produced as outputs.

id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*string
Min length1

Custom asset type

descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150

Explain

Return query explanation in addition to result. Allowed values: notes, full, fail, debug.

Input document

Input data rendered with flow variables and passed to partial evaluation.

Enable metrics

Return query performance metrics; defaults to false.

Compile options

Additional options forwarded to OPA compile (see OPA docs).

Bearer token

SubTypestring

Unknowns

Paths to treat as unknown during partial evaluation so OPA emits residual queries.

Whether result is defined

Compiled queries (if present)

Raw OPA response

Compile result