1. Packages
  2. Packages
  3. Grafana Cloud
  4. API Docs
  5. assistant
  6. Rule
Viewing docs for Grafana v2.32.0
published on Saturday, Jun 13, 2026 by pulumiverse
grafana logo
Viewing docs for Grafana v2.32.0
published on Saturday, Jun 13, 2026 by pulumiverse

    Manages a Grafana Assistant rule that is injected into the assistant system prompt.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as grafana from "@pulumiverse/grafana";
    
    const example = new grafana.assistant.Rule("example", {
        name: "Prefer RED metrics",
        ruleContent: "When summarizing service health, prefer RED metrics.",
        scope: "tenant",
        priority: 10,
        applications: ["assistant"],
    });
    
    import pulumi
    import pulumiverse_grafana as grafana
    
    example = grafana.assistant.Rule("example",
        name="Prefer RED metrics",
        rule_content="When summarizing service health, prefer RED metrics.",
        scope="tenant",
        priority=10,
        applications=["assistant"])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-grafana/sdk/v2/go/grafana/assistant"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := assistant.NewRule(ctx, "example", &assistant.RuleArgs{
    			Name:        pulumi.String("Prefer RED metrics"),
    			RuleContent: pulumi.String("When summarizing service health, prefer RED metrics."),
    			Scope:       pulumi.String("tenant"),
    			Priority:    pulumi.Int(10),
    			Applications: pulumi.StringArray{
    				pulumi.String("assistant"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Grafana = Pulumiverse.Grafana;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Grafana.Assistant.Rule("example", new()
        {
            Name = "Prefer RED metrics",
            RuleContent = "When summarizing service health, prefer RED metrics.",
            Scope = "tenant",
            Priority = 10,
            Applications = new[]
            {
                "assistant",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.grafana.assistant.Rule;
    import com.pulumi.grafana.assistant.RuleArgs;
    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 Rule("example", RuleArgs.builder()
                .name("Prefer RED metrics")
                .ruleContent("When summarizing service health, prefer RED metrics.")
                .scope("tenant")
                .priority(10)
                .applications("assistant")
                .build());
    
        }
    }
    
    resources:
      example:
        type: grafana:assistant:Rule
        properties:
          name: Prefer RED metrics
          ruleContent: When summarizing service health, prefer RED metrics.
          scope: tenant
          priority: 10
          applications:
            - assistant
    
    Example coming soon!
    

    Create Rule Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Rule(name: string, args: RuleArgs, opts?: CustomResourceOptions);
    @overload
    def Rule(resource_name: str,
             args: RuleArgs,
             opts: Optional[ResourceOptions] = None)
    
    @overload
    def Rule(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             rule_content: Optional[str] = None,
             scope: Optional[str] = None,
             applications: Optional[Sequence[str]] = None,
             description: Optional[str] = None,
             enabled: Optional[bool] = None,
             name: Optional[str] = None,
             priority: Optional[int] = None)
    func NewRule(ctx *Context, name string, args RuleArgs, opts ...ResourceOption) (*Rule, error)
    public Rule(string name, RuleArgs args, CustomResourceOptions? opts = null)
    public Rule(String name, RuleArgs args)
    public Rule(String name, RuleArgs args, CustomResourceOptions options)
    
    type: grafana:assistant:Rule
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "grafana_assistant_rule" "name" {
        # resource properties
    }

    Parameters

    name string
    The unique name of the resource.
    args RuleArgs
    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 RuleArgs
    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 RuleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args RuleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args RuleArgs
    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 ruleResource = new Grafana.Assistant.Rule("ruleResource", new()
    {
        RuleContent = "string",
        Scope = "string",
        Applications = new[]
        {
            "string",
        },
        Description = "string",
        Enabled = false,
        Name = "string",
        Priority = 0,
    });
    
    example, err := assistant.NewRule(ctx, "ruleResource", &assistant.RuleArgs{
    	RuleContent: pulumi.String("string"),
    	Scope:       pulumi.String("string"),
    	Applications: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Description: pulumi.String("string"),
    	Enabled:     pulumi.Bool(false),
    	Name:        pulumi.String("string"),
    	Priority:    pulumi.Int(0),
    })
    
    resource "grafana_assistant_rule" "ruleResource" {
      rule_content = "string"
      scope        = "string"
      applications = ["string"]
      description  = "string"
      enabled      = false
      name         = "string"
      priority     = 0
    }
    
    var ruleResource = new Rule("ruleResource", RuleArgs.builder()
        .ruleContent("string")
        .scope("string")
        .applications("string")
        .description("string")
        .enabled(false)
        .name("string")
        .priority(0)
        .build());
    
    rule_resource = grafana.assistant.Rule("ruleResource",
        rule_content="string",
        scope="string",
        applications=["string"],
        description="string",
        enabled=False,
        name="string",
        priority=0)
    
    const ruleResource = new grafana.assistant.Rule("ruleResource", {
        ruleContent: "string",
        scope: "string",
        applications: ["string"],
        description: "string",
        enabled: false,
        name: "string",
        priority: 0,
    });
    
    type: grafana:assistant:Rule
    properties:
        applications:
            - string
        description: string
        enabled: false
        name: string
        priority: 0
        ruleContent: string
        scope: string
    

    Rule 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 Rule resource accepts the following input properties:

    RuleContent string
    The rule text included in the assistant system prompt.
    Scope string
    Whether the resource is visible to the whole tenant (tenant) or only the creating user (user).
    Applications List<string>
    Applications where this resource applies. Valid values: assistant, loop, infrastructureMemory (rules only), all. Defaults to all applications when unset.
    Description string
    Optional description of the rule.
    Enabled bool
    Whether the resource is enabled.
    Name string
    The rule name.
    Priority int
    Rule priority (lower values apply first).
    RuleContent string
    The rule text included in the assistant system prompt.
    Scope string
    Whether the resource is visible to the whole tenant (tenant) or only the creating user (user).
    Applications []string
    Applications where this resource applies. Valid values: assistant, loop, infrastructureMemory (rules only), all. Defaults to all applications when unset.
    Description string
    Optional description of the rule.
    Enabled bool
    Whether the resource is enabled.
    Name string
    The rule name.
    Priority int
    Rule priority (lower values apply first).
    rule_content string
    The rule text included in the assistant system prompt.
    scope string
    Whether the resource is visible to the whole tenant (tenant) or only the creating user (user).
    applications list(string)
    Applications where this resource applies. Valid values: assistant, loop, infrastructureMemory (rules only), all. Defaults to all applications when unset.
    description string
    Optional description of the rule.
    enabled bool
    Whether the resource is enabled.
    name string
    The rule name.
    priority number
    Rule priority (lower values apply first).
    ruleContent String
    The rule text included in the assistant system prompt.
    scope String
    Whether the resource is visible to the whole tenant (tenant) or only the creating user (user).
    applications List<String>
    Applications where this resource applies. Valid values: assistant, loop, infrastructureMemory (rules only), all. Defaults to all applications when unset.
    description String
    Optional description of the rule.
    enabled Boolean
    Whether the resource is enabled.
    name String
    The rule name.
    priority Integer
    Rule priority (lower values apply first).
    ruleContent string
    The rule text included in the assistant system prompt.
    scope string
    Whether the resource is visible to the whole tenant (tenant) or only the creating user (user).
    applications string[]
    Applications where this resource applies. Valid values: assistant, loop, infrastructureMemory (rules only), all. Defaults to all applications when unset.
    description string
    Optional description of the rule.
    enabled boolean
    Whether the resource is enabled.
    name string
    The rule name.
    priority number
    Rule priority (lower values apply first).
    rule_content str
    The rule text included in the assistant system prompt.
    scope str
    Whether the resource is visible to the whole tenant (tenant) or only the creating user (user).
    applications Sequence[str]
    Applications where this resource applies. Valid values: assistant, loop, infrastructureMemory (rules only), all. Defaults to all applications when unset.
    description str
    Optional description of the rule.
    enabled bool
    Whether the resource is enabled.
    name str
    The rule name.
    priority int
    Rule priority (lower values apply first).
    ruleContent String
    The rule text included in the assistant system prompt.
    scope String
    Whether the resource is visible to the whole tenant (tenant) or only the creating user (user).
    applications List<String>
    Applications where this resource applies. Valid values: assistant, loop, infrastructureMemory (rules only), all. Defaults to all applications when unset.
    description String
    Optional description of the rule.
    enabled Boolean
    Whether the resource is enabled.
    name String
    The rule name.
    priority Number
    Rule priority (lower values apply first).

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Rule 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 Rule Resource

    Get an existing Rule 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?: RuleState, opts?: CustomResourceOptions): Rule
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            applications: Optional[Sequence[str]] = None,
            description: Optional[str] = None,
            enabled: Optional[bool] = None,
            name: Optional[str] = None,
            priority: Optional[int] = None,
            rule_content: Optional[str] = None,
            scope: Optional[str] = None) -> Rule
    func GetRule(ctx *Context, name string, id IDInput, state *RuleState, opts ...ResourceOption) (*Rule, error)
    public static Rule Get(string name, Input<string> id, RuleState? state, CustomResourceOptions? opts = null)
    public static Rule get(String name, Output<String> id, RuleState state, CustomResourceOptions options)
    resources:  _:    type: grafana:assistant:Rule    get:      id: ${id}
    import {
      to = grafana_assistant_rule.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.
    The following state arguments are supported:
    Applications List<string>
    Applications where this resource applies. Valid values: assistant, loop, infrastructureMemory (rules only), all. Defaults to all applications when unset.
    Description string
    Optional description of the rule.
    Enabled bool
    Whether the resource is enabled.
    Name string
    The rule name.
    Priority int
    Rule priority (lower values apply first).
    RuleContent string
    The rule text included in the assistant system prompt.
    Scope string
    Whether the resource is visible to the whole tenant (tenant) or only the creating user (user).
    Applications []string
    Applications where this resource applies. Valid values: assistant, loop, infrastructureMemory (rules only), all. Defaults to all applications when unset.
    Description string
    Optional description of the rule.
    Enabled bool
    Whether the resource is enabled.
    Name string
    The rule name.
    Priority int
    Rule priority (lower values apply first).
    RuleContent string
    The rule text included in the assistant system prompt.
    Scope string
    Whether the resource is visible to the whole tenant (tenant) or only the creating user (user).
    applications list(string)
    Applications where this resource applies. Valid values: assistant, loop, infrastructureMemory (rules only), all. Defaults to all applications when unset.
    description string
    Optional description of the rule.
    enabled bool
    Whether the resource is enabled.
    name string
    The rule name.
    priority number
    Rule priority (lower values apply first).
    rule_content string
    The rule text included in the assistant system prompt.
    scope string
    Whether the resource is visible to the whole tenant (tenant) or only the creating user (user).
    applications List<String>
    Applications where this resource applies. Valid values: assistant, loop, infrastructureMemory (rules only), all. Defaults to all applications when unset.
    description String
    Optional description of the rule.
    enabled Boolean
    Whether the resource is enabled.
    name String
    The rule name.
    priority Integer
    Rule priority (lower values apply first).
    ruleContent String
    The rule text included in the assistant system prompt.
    scope String
    Whether the resource is visible to the whole tenant (tenant) or only the creating user (user).
    applications string[]
    Applications where this resource applies. Valid values: assistant, loop, infrastructureMemory (rules only), all. Defaults to all applications when unset.
    description string
    Optional description of the rule.
    enabled boolean
    Whether the resource is enabled.
    name string
    The rule name.
    priority number
    Rule priority (lower values apply first).
    ruleContent string
    The rule text included in the assistant system prompt.
    scope string
    Whether the resource is visible to the whole tenant (tenant) or only the creating user (user).
    applications Sequence[str]
    Applications where this resource applies. Valid values: assistant, loop, infrastructureMemory (rules only), all. Defaults to all applications when unset.
    description str
    Optional description of the rule.
    enabled bool
    Whether the resource is enabled.
    name str
    The rule name.
    priority int
    Rule priority (lower values apply first).
    rule_content str
    The rule text included in the assistant system prompt.
    scope str
    Whether the resource is visible to the whole tenant (tenant) or only the creating user (user).
    applications List<String>
    Applications where this resource applies. Valid values: assistant, loop, infrastructureMemory (rules only), all. Defaults to all applications when unset.
    description String
    Optional description of the rule.
    enabled Boolean
    Whether the resource is enabled.
    name String
    The rule name.
    priority Number
    Rule priority (lower values apply first).
    ruleContent String
    The rule text included in the assistant system prompt.
    scope String
    Whether the resource is visible to the whole tenant (tenant) or only the creating user (user).

    Import

    terraform import grafana_assistant_rule.name "{{ 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 grafana Terraform Provider.
    grafana logo
    Viewing docs for Grafana v2.32.0
    published on Saturday, Jun 13, 2026 by pulumiverse

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial