published on Friday, Aug 7, 2026 by pulumiverse
published on Friday, Aug 7, 2026 by pulumiverse
Manages an action attached to a Grafana Agent Observability evaluation rule. When the rule’s aggregate verdict matches the configured condition, matching conversations are added to one or more collections.
Requires a Grafana instance with the grafana-agento11y-app plugin installed. Writes require a user or service account with the grafana-agento11y-app.eval:write permission, which only the Admin basic role grants by default.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as grafana from "@pulumiverse/grafana";
const example = new grafana.agento11y.Evaluator("example", {
evaluatorId: "no_secrets",
version: "1",
kind: "regex",
config: JSON.stringify({
pattern: "(?i)(api[_-]?key|password|secret)",
}),
outputKeys: JSON.stringify([{
key: "clean",
type: "bool",
}]),
});
const exampleEvaluationRule = new grafana.agento11y.EvaluationRule("example", {
ruleId: "score_user_turns",
selector: "user_visible_turn",
sampleRate: 0.1,
evaluatorIds: [example.evaluatorId],
});
const failed = new grafana.agento11y.Collection("failed", {
name: "Failed evaluations",
description: "Conversations where every evaluator failed.",
});
// Adds conversations to a collection when every evaluator on the rule fails.
const exampleRuleAction = new grafana.agento11y.RuleAction("example", {
ruleId: exampleEvaluationRule.ruleId,
condition: "all_evaluators_fail",
collectionIds: [failed.id],
});
import pulumi
import json
import pulumiverse_grafana as grafana
example = grafana.agento11y.Evaluator("example",
evaluator_id="no_secrets",
version="1",
kind="regex",
config=json.dumps({
"pattern": "(?i)(api[_-]?key|password|secret)",
}),
output_keys=json.dumps([{
"key": "clean",
"type": "bool",
}]))
example_evaluation_rule = grafana.agento11y.EvaluationRule("example",
rule_id="score_user_turns",
selector="user_visible_turn",
sample_rate=0.1,
evaluator_ids=[example.evaluator_id])
failed = grafana.agento11y.Collection("failed",
name="Failed evaluations",
description="Conversations where every evaluator failed.")
# Adds conversations to a collection when every evaluator on the rule fails.
example_rule_action = grafana.agento11y.RuleAction("example",
rule_id=example_evaluation_rule.rule_id,
condition="all_evaluators_fail",
collection_ids=[failed.id])
package main
import (
"encoding/json"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumiverse/pulumi-grafana/sdk/v2/go/grafana/agento11y"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
tmpJSON0, err := json.Marshal(map[string]interface{}{
"pattern": "(?i)(api[_-]?key|password|secret)",
})
if err != nil {
return err
}
json0 := string(tmpJSON0)
tmpJSON1, err := json.Marshal([]map[string]interface{}{
map[string]interface{}{
"key": "clean",
"type": "bool",
},
})
if err != nil {
return err
}
json1 := string(tmpJSON1)
example, err := agento11y.NewEvaluator(ctx, "example", &agento11y.EvaluatorArgs{
EvaluatorId: pulumi.String("no_secrets"),
Version: pulumi.String("1"),
Kind: pulumi.String("regex"),
Config: pulumi.String(pulumi.String(json0)),
OutputKeys: pulumi.String(pulumi.String(json1)),
})
if err != nil {
return err
}
exampleEvaluationRule, err := agento11y.NewEvaluationRule(ctx, "example", &agento11y.EvaluationRuleArgs{
RuleId: pulumi.String("score_user_turns"),
Selector: pulumi.String("user_visible_turn"),
SampleRate: pulumi.Float64(0.1),
EvaluatorIds: pulumi.StringArray{
example.EvaluatorId,
},
})
if err != nil {
return err
}
failed, err := agento11y.NewCollection(ctx, "failed", &agento11y.CollectionArgs{
Name: pulumi.String("Failed evaluations"),
Description: pulumi.String("Conversations where every evaluator failed."),
})
if err != nil {
return err
}
// Adds conversations to a collection when every evaluator on the rule fails.
_, err = agento11y.NewRuleAction(ctx, "example", &agento11y.RuleActionArgs{
RuleId: exampleEvaluationRule.RuleId,
Condition: pulumi.String("all_evaluators_fail"),
CollectionIds: pulumi.StringArray{
failed.ID(),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Grafana = Pulumiverse.Grafana;
return await Deployment.RunAsync(() =>
{
var example = new Grafana.Agento11y.Evaluator("example", new()
{
EvaluatorId = "no_secrets",
Version = "1",
Kind = "regex",
Config = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["pattern"] = "(?i)(api[_-]?key|password|secret)",
}),
OutputKeys = JsonSerializer.Serialize(new[]
{
new Dictionary<string, object?>
{
["key"] = "clean",
["type"] = "bool",
},
}),
});
var exampleEvaluationRule = new Grafana.Agento11y.EvaluationRule("example", new()
{
RuleId = "score_user_turns",
Selector = "user_visible_turn",
SampleRate = 0.1,
EvaluatorIds = new[]
{
example.EvaluatorId,
},
});
var failed = new Grafana.Agento11y.Collection("failed", new()
{
Name = "Failed evaluations",
Description = "Conversations where every evaluator failed.",
});
// Adds conversations to a collection when every evaluator on the rule fails.
var exampleRuleAction = new Grafana.Agento11y.RuleAction("example", new()
{
RuleId = exampleEvaluationRule.RuleId,
Condition = "all_evaluators_fail",
CollectionIds = new[]
{
failed.Id,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.grafana.agento11y.Evaluator;
import com.pulumi.grafana.agento11y.EvaluatorArgs;
import com.pulumi.grafana.agento11y.EvaluationRule;
import com.pulumi.grafana.agento11y.EvaluationRuleArgs;
import com.pulumi.grafana.agento11y.Collection;
import com.pulumi.grafana.agento11y.CollectionArgs;
import com.pulumi.grafana.agento11y.RuleAction;
import com.pulumi.grafana.agento11y.RuleActionArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new Evaluator("example", EvaluatorArgs.builder()
.evaluatorId("no_secrets")
.version("1")
.kind("regex")
.config(serializeJson(
jsonObject(
jsonProperty("pattern", "(?i)(api[_-]?key|password|secret)")
)))
.outputKeys(serializeJson(
jsonArray(jsonObject(
jsonProperty("key", "clean"),
jsonProperty("type", "bool")
))))
.build());
var exampleEvaluationRule = new EvaluationRule("exampleEvaluationRule", EvaluationRuleArgs.builder()
.ruleId("score_user_turns")
.selector("user_visible_turn")
.sampleRate(0.1)
.evaluatorIds(example.evaluatorId())
.build());
var failed = new Collection("failed", CollectionArgs.builder()
.name("Failed evaluations")
.description("Conversations where every evaluator failed.")
.build());
// Adds conversations to a collection when every evaluator on the rule fails.
var exampleRuleAction = new RuleAction("exampleRuleAction", RuleActionArgs.builder()
.ruleId(exampleEvaluationRule.ruleId())
.condition("all_evaluators_fail")
.collectionIds(failed.id())
.build());
}
}
resources:
example:
type: grafana:agento11y:Evaluator
properties:
evaluatorId: no_secrets
version: '1'
kind: regex
config:
fn::toJSON:
pattern: (?i)(api[_-]?key|password|secret)
outputKeys:
fn::toJSON:
- key: clean
type: bool
exampleEvaluationRule:
type: grafana:agento11y:EvaluationRule
name: example
properties:
ruleId: score_user_turns
selector: user_visible_turn
sampleRate: 0.1
evaluatorIds:
- ${example.evaluatorId}
failed:
type: grafana:agento11y:Collection
properties:
name: Failed evaluations
description: Conversations where every evaluator failed.
# Adds conversations to a collection when every evaluator on the rule fails.
exampleRuleAction:
type: grafana:agento11y:RuleAction
name: example
properties:
ruleId: ${exampleEvaluationRule.ruleId}
condition: all_evaluators_fail
collectionIds:
- ${failed.id}
Example coming soon!
Create RuleAction Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new RuleAction(name: string, args: RuleActionArgs, opts?: CustomResourceOptions);@overload
def RuleAction(resource_name: str,
args: RuleActionArgs,
opts: Optional[ResourceOptions] = None)
@overload
def RuleAction(resource_name: str,
opts: Optional[ResourceOptions] = None,
collection_ids: Optional[Sequence[str]] = None,
condition: Optional[str] = None,
rule_id: Optional[str] = None,
enabled: Optional[bool] = None)func NewRuleAction(ctx *Context, name string, args RuleActionArgs, opts ...ResourceOption) (*RuleAction, error)public RuleAction(string name, RuleActionArgs args, CustomResourceOptions? opts = null)
public RuleAction(String name, RuleActionArgs args)
public RuleAction(String name, RuleActionArgs args, CustomResourceOptions options)
type: grafana:agento11y:RuleAction
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
resource "grafana_agento11y_rule_action" "name" {
# resource properties
}Parameters
- name string
- The unique name of the resource.
- args RuleActionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args RuleActionArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args RuleActionArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args RuleActionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args RuleActionArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var ruleActionResource = new Grafana.Agento11y.RuleAction("ruleActionResource", new()
{
CollectionIds = new[]
{
"string",
},
Condition = "string",
RuleId = "string",
Enabled = false,
});
example, err := agento11y.NewRuleAction(ctx, "ruleActionResource", &agento11y.RuleActionArgs{
CollectionIds: pulumi.StringArray{
pulumi.String("string"),
},
Condition: pulumi.String("string"),
RuleId: pulumi.String("string"),
Enabled: pulumi.Bool(false),
})
resource "grafana_agento11y_rule_action" "ruleActionResource" {
lifecycle {
create_before_destroy = true
}
collection_ids = ["string"]
condition = "string"
rule_id = "string"
enabled = false
}
var ruleActionResource = new RuleAction("ruleActionResource", RuleActionArgs.builder()
.collectionIds("string")
.condition("string")
.ruleId("string")
.enabled(false)
.build());
rule_action_resource = grafana.agento11y.RuleAction("ruleActionResource",
collection_ids=["string"],
condition="string",
rule_id="string",
enabled=False)
const ruleActionResource = new grafana.agento11y.RuleAction("ruleActionResource", {
collectionIds: ["string"],
condition: "string",
ruleId: "string",
enabled: false,
});
type: grafana:agento11y:RuleAction
properties:
collectionIds:
- string
condition: string
enabled: false
ruleId: string
RuleAction Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The RuleAction resource accepts the following input properties:
- Collection
Ids List<string> - IDs of the collections that matching conversations are added to. Must be non-empty.
- Condition string
- Aggregate verdict that triggers the action. One of
allEvaluatorsPass,allEvaluatorsFail. - Rule
Id string - ID of the evaluation rule this action is attached to. Changing this forces a new resource.
- Enabled bool
- Whether the action is enabled. Defaults to
true.
- Collection
Ids []string - IDs of the collections that matching conversations are added to. Must be non-empty.
- Condition string
- Aggregate verdict that triggers the action. One of
allEvaluatorsPass,allEvaluatorsFail. - Rule
Id string - ID of the evaluation rule this action is attached to. Changing this forces a new resource.
- Enabled bool
- Whether the action is enabled. Defaults to
true.
- collection_
ids list(string) - IDs of the collections that matching conversations are added to. Must be non-empty.
- condition string
- Aggregate verdict that triggers the action. One of
allEvaluatorsPass,allEvaluatorsFail. - rule_
id string - ID of the evaluation rule this action is attached to. Changing this forces a new resource.
- enabled bool
- Whether the action is enabled. Defaults to
true.
- collection
Ids List<String> - IDs of the collections that matching conversations are added to. Must be non-empty.
- condition String
- Aggregate verdict that triggers the action. One of
allEvaluatorsPass,allEvaluatorsFail. - rule
Id String - ID of the evaluation rule this action is attached to. Changing this forces a new resource.
- enabled Boolean
- Whether the action is enabled. Defaults to
true.
- collection
Ids string[] - IDs of the collections that matching conversations are added to. Must be non-empty.
- condition string
- Aggregate verdict that triggers the action. One of
allEvaluatorsPass,allEvaluatorsFail. - rule
Id string - ID of the evaluation rule this action is attached to. Changing this forces a new resource.
- enabled boolean
- Whether the action is enabled. Defaults to
true.
- collection_
ids Sequence[str] - IDs of the collections that matching conversations are added to. Must be non-empty.
- condition str
- Aggregate verdict that triggers the action. One of
allEvaluatorsPass,allEvaluatorsFail. - rule_
id str - ID of the evaluation rule this action is attached to. Changing this forces a new resource.
- enabled bool
- Whether the action is enabled. Defaults to
true.
- collection
Ids List<String> - IDs of the collections that matching conversations are added to. Must be non-empty.
- condition String
- Aggregate verdict that triggers the action. One of
allEvaluatorsPass,allEvaluatorsFail. - rule
Id String - ID of the evaluation rule this action is attached to. Changing this forces a new resource.
- enabled Boolean
- Whether the action is enabled. Defaults to
true.
Outputs
All input properties are implicitly available as output properties. Additionally, the RuleAction resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing RuleAction Resource
Get an existing RuleAction resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: RuleActionState, opts?: CustomResourceOptions): RuleAction@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
collection_ids: Optional[Sequence[str]] = None,
condition: Optional[str] = None,
enabled: Optional[bool] = None,
rule_id: Optional[str] = None) -> RuleActionfunc GetRuleAction(ctx *Context, name string, id IDInput, state *RuleActionState, opts ...ResourceOption) (*RuleAction, error)public static RuleAction Get(string name, Input<string> id, RuleActionState? state, CustomResourceOptions? opts = null)public static RuleAction get(String name, Output<String> id, RuleActionState state, CustomResourceOptions options)resources: _: type: grafana:agento11y:RuleAction get: id: ${id}import {
to = grafana_agento11y_rule_action.example
id = "${id}"
}
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Collection
Ids List<string> - IDs of the collections that matching conversations are added to. Must be non-empty.
- Condition string
- Aggregate verdict that triggers the action. One of
allEvaluatorsPass,allEvaluatorsFail. - Enabled bool
- Whether the action is enabled. Defaults to
true. - Rule
Id string - ID of the evaluation rule this action is attached to. Changing this forces a new resource.
- Collection
Ids []string - IDs of the collections that matching conversations are added to. Must be non-empty.
- Condition string
- Aggregate verdict that triggers the action. One of
allEvaluatorsPass,allEvaluatorsFail. - Enabled bool
- Whether the action is enabled. Defaults to
true. - Rule
Id string - ID of the evaluation rule this action is attached to. Changing this forces a new resource.
- collection_
ids list(string) - IDs of the collections that matching conversations are added to. Must be non-empty.
- condition string
- Aggregate verdict that triggers the action. One of
allEvaluatorsPass,allEvaluatorsFail. - enabled bool
- Whether the action is enabled. Defaults to
true. - rule_
id string - ID of the evaluation rule this action is attached to. Changing this forces a new resource.
- collection
Ids List<String> - IDs of the collections that matching conversations are added to. Must be non-empty.
- condition String
- Aggregate verdict that triggers the action. One of
allEvaluatorsPass,allEvaluatorsFail. - enabled Boolean
- Whether the action is enabled. Defaults to
true. - rule
Id String - ID of the evaluation rule this action is attached to. Changing this forces a new resource.
- collection
Ids string[] - IDs of the collections that matching conversations are added to. Must be non-empty.
- condition string
- Aggregate verdict that triggers the action. One of
allEvaluatorsPass,allEvaluatorsFail. - enabled boolean
- Whether the action is enabled. Defaults to
true. - rule
Id string - ID of the evaluation rule this action is attached to. Changing this forces a new resource.
- collection_
ids Sequence[str] - IDs of the collections that matching conversations are added to. Must be non-empty.
- condition str
- Aggregate verdict that triggers the action. One of
allEvaluatorsPass,allEvaluatorsFail. - enabled bool
- Whether the action is enabled. Defaults to
true. - rule_
id str - ID of the evaluation rule this action is attached to. Changing this forces a new resource.
- collection
Ids List<String> - IDs of the collections that matching conversations are added to. Must be non-empty.
- condition String
- Aggregate verdict that triggers the action. One of
allEvaluatorsPass,allEvaluatorsFail. - enabled Boolean
- Whether the action is enabled. Defaults to
true. - rule
Id String - ID of the evaluation rule this action is attached to. Changing this forces a new resource.
Import
terraform import grafana_agento11y_rule_action.name "{{ rule_id }}:{{ action_id }}"
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- grafana pulumiverse/pulumi-grafana
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
grafanaTerraform Provider.
published on Friday, Aug 7, 2026 by pulumiverse