1. Packages
  2. Grafana Cloud
  3. API Docs
  4. RuleGroup
Grafana v0.16.1 published on Saturday, Mar 15, 2025 by pulumiverse

grafana.RuleGroup

Explore with Pulumi AI

Deprecated: grafana.index/rulegroup.RuleGroup has been deprecated in favor of grafana.alerting/rulegroup.RuleGroup

Manages Grafana Alerting rule groups.

This resource requires Grafana 9.1.0 or later.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as grafana from "@pulumiverse/grafana";

const ruleFolder = new grafana.oss.Folder("rule_folder", {title: "My Alert Rule Folder"});
const myAlertRule = new grafana.alerting.RuleGroup("my_alert_rule", {
    name: "My Rule Group",
    folderUid: ruleFolder.uid,
    intervalSeconds: 240,
    orgId: "1",
    rules: [{
        name: "My Alert Rule 1",
        "for": "2m",
        condition: "B",
        noDataState: "NoData",
        execErrState: "Alerting",
        annotations: {
            a: "b",
            c: "d",
        },
        labels: {
            e: "f",
            g: "h",
        },
        isPaused: false,
        datas: [
            {
                refId: "A",
                queryType: "",
                relativeTimeRange: {
                    from: 600,
                    to: 0,
                },
                datasourceUid: "PD8C576611E62080A",
                model: JSON.stringify({
                    hide: false,
                    intervalMs: 1000,
                    maxDataPoints: 43200,
                    refId: "A",
                }),
            },
            {
                refId: "B",
                queryType: "",
                relativeTimeRange: {
                    from: 0,
                    to: 0,
                },
                datasourceUid: "-100",
                model: `{
    "conditions": [
        {
        "evaluator": {
            "params": [
            3
            ],
            "type": "gt"
        },
        "operator": {
            "type": "and"
        },
        "query": {
            "params": [
            "A"
            ]
        },
        "reducer": {
            "params": [],
            "type": "last"
        },
        "type": "query"
        }
    ],
    "datasource": {
        "type": "__expr__",
        "uid": "-100"
    },
    "hide": false,
    "intervalMs": 1000,
    "maxDataPoints": 43200,
    "refId": "B",
    "type": "classic_conditions"
}
`,
            },
        ],
    }],
});
Copy
import pulumi
import json
import pulumiverse_grafana as grafana

rule_folder = grafana.oss.Folder("rule_folder", title="My Alert Rule Folder")
my_alert_rule = grafana.alerting.RuleGroup("my_alert_rule",
    name="My Rule Group",
    folder_uid=rule_folder.uid,
    interval_seconds=240,
    org_id="1",
    rules=[{
        "name": "My Alert Rule 1",
        "for_": "2m",
        "condition": "B",
        "no_data_state": "NoData",
        "exec_err_state": "Alerting",
        "annotations": {
            "a": "b",
            "c": "d",
        },
        "labels": {
            "e": "f",
            "g": "h",
        },
        "is_paused": False,
        "datas": [
            {
                "ref_id": "A",
                "query_type": "",
                "relative_time_range": {
                    "from_": 600,
                    "to": 0,
                },
                "datasource_uid": "PD8C576611E62080A",
                "model": json.dumps({
                    "hide": False,
                    "intervalMs": 1000,
                    "maxDataPoints": 43200,
                    "refId": "A",
                }),
            },
            {
                "ref_id": "B",
                "query_type": "",
                "relative_time_range": {
                    "from_": 0,
                    "to": 0,
                },
                "datasource_uid": "-100",
                "model": """{
    "conditions": [
        {
        "evaluator": {
            "params": [
            3
            ],
            "type": "gt"
        },
        "operator": {
            "type": "and"
        },
        "query": {
            "params": [
            "A"
            ]
        },
        "reducer": {
            "params": [],
            "type": "last"
        },
        "type": "query"
        }
    ],
    "datasource": {
        "type": "__expr__",
        "uid": "-100"
    },
    "hide": false,
    "intervalMs": 1000,
    "maxDataPoints": 43200,
    "refId": "B",
    "type": "classic_conditions"
}
""",
            },
        ],
    }])
Copy
package main

import (
	"encoding/json"

	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumiverse/pulumi-grafana/sdk/go/grafana/alerting"
	"github.com/pulumiverse/pulumi-grafana/sdk/go/grafana/oss"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		ruleFolder, err := oss.NewFolder(ctx, "rule_folder", &oss.FolderArgs{
			Title: pulumi.String("My Alert Rule Folder"),
		})
		if err != nil {
			return err
		}
		tmpJSON0, err := json.Marshal(map[string]interface{}{
			"hide":          false,
			"intervalMs":    1000,
			"maxDataPoints": 43200,
			"refId":         "A",
		})
		if err != nil {
			return err
		}
		json0 := string(tmpJSON0)
		_, err = alerting.NewRuleGroup(ctx, "my_alert_rule", &alerting.RuleGroupArgs{
			Name:            pulumi.String("My Rule Group"),
			FolderUid:       ruleFolder.Uid,
			IntervalSeconds: pulumi.Int(240),
			OrgId:           pulumi.String("1"),
			Rules: alerting.RuleGroupRuleArray{
				&alerting.RuleGroupRuleArgs{
					Name:         pulumi.String("My Alert Rule 1"),
					For:          pulumi.String("2m"),
					Condition:    pulumi.String("B"),
					NoDataState:  pulumi.String("NoData"),
					ExecErrState: pulumi.String("Alerting"),
					Annotations: pulumi.StringMap{
						"a": pulumi.String("b"),
						"c": pulumi.String("d"),
					},
					Labels: pulumi.StringMap{
						"e": pulumi.String("f"),
						"g": pulumi.String("h"),
					},
					IsPaused: pulumi.Bool(false),
					Datas: alerting.RuleGroupRuleDataArray{
						&alerting.RuleGroupRuleDataArgs{
							RefId:     pulumi.String("A"),
							QueryType: pulumi.String(""),
							RelativeTimeRange: &alerting.RuleGroupRuleDataRelativeTimeRangeArgs{
								From: pulumi.Int(600),
								To:   pulumi.Int(0),
							},
							DatasourceUid: pulumi.String("PD8C576611E62080A"),
							Model:         pulumi.String(json0),
						},
						&alerting.RuleGroupRuleDataArgs{
							RefId:     pulumi.String("B"),
							QueryType: pulumi.String(""),
							RelativeTimeRange: &alerting.RuleGroupRuleDataRelativeTimeRangeArgs{
								From: pulumi.Int(0),
								To:   pulumi.Int(0),
							},
							DatasourceUid: pulumi.String("-100"),
							Model: pulumi.String(`{
    "conditions": [
        {
        "evaluator": {
            "params": [
            3
            ],
            "type": "gt"
        },
        "operator": {
            "type": "and"
        },
        "query": {
            "params": [
            "A"
            ]
        },
        "reducer": {
            "params": [],
            "type": "last"
        },
        "type": "query"
        }
    ],
    "datasource": {
        "type": "__expr__",
        "uid": "-100"
    },
    "hide": false,
    "intervalMs": 1000,
    "maxDataPoints": 43200,
    "refId": "B",
    "type": "classic_conditions"
}
`),
						},
					},
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Grafana = Pulumiverse.Grafana;

return await Deployment.RunAsync(() => 
{
    var ruleFolder = new Grafana.Oss.Folder("rule_folder", new()
    {
        Title = "My Alert Rule Folder",
    });

    var myAlertRule = new Grafana.Alerting.RuleGroup("my_alert_rule", new()
    {
        Name = "My Rule Group",
        FolderUid = ruleFolder.Uid,
        IntervalSeconds = 240,
        OrgId = "1",
        Rules = new[]
        {
            new Grafana.Alerting.Inputs.RuleGroupRuleArgs
            {
                Name = "My Alert Rule 1",
                For = "2m",
                Condition = "B",
                NoDataState = "NoData",
                ExecErrState = "Alerting",
                Annotations = 
                {
                    { "a", "b" },
                    { "c", "d" },
                },
                Labels = 
                {
                    { "e", "f" },
                    { "g", "h" },
                },
                IsPaused = false,
                Datas = new[]
                {
                    new Grafana.Alerting.Inputs.RuleGroupRuleDataArgs
                    {
                        RefId = "A",
                        QueryType = "",
                        RelativeTimeRange = new Grafana.Alerting.Inputs.RuleGroupRuleDataRelativeTimeRangeArgs
                        {
                            From = 600,
                            To = 0,
                        },
                        DatasourceUid = "PD8C576611E62080A",
                        Model = JsonSerializer.Serialize(new Dictionary<string, object?>
                        {
                            ["hide"] = false,
                            ["intervalMs"] = 1000,
                            ["maxDataPoints"] = 43200,
                            ["refId"] = "A",
                        }),
                    },
                    new Grafana.Alerting.Inputs.RuleGroupRuleDataArgs
                    {
                        RefId = "B",
                        QueryType = "",
                        RelativeTimeRange = new Grafana.Alerting.Inputs.RuleGroupRuleDataRelativeTimeRangeArgs
                        {
                            From = 0,
                            To = 0,
                        },
                        DatasourceUid = "-100",
                        Model = @"{
    ""conditions"": [
        {
        ""evaluator"": {
            ""params"": [
            3
            ],
            ""type"": ""gt""
        },
        ""operator"": {
            ""type"": ""and""
        },
        ""query"": {
            ""params"": [
            ""A""
            ]
        },
        ""reducer"": {
            ""params"": [],
            ""type"": ""last""
        },
        ""type"": ""query""
        }
    ],
    ""datasource"": {
        ""type"": ""__expr__"",
        ""uid"": ""-100""
    },
    ""hide"": false,
    ""intervalMs"": 1000,
    ""maxDataPoints"": 43200,
    ""refId"": ""B"",
    ""type"": ""classic_conditions""
}
",
                    },
                },
            },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.grafana.oss.Folder;
import com.pulumi.grafana.oss.FolderArgs;
import com.pulumi.grafana.alerting.RuleGroup;
import com.pulumi.grafana.alerting.RuleGroupArgs;
import com.pulumi.grafana.alerting.inputs.RuleGroupRuleArgs;
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 ruleFolder = new Folder("ruleFolder", FolderArgs.builder()
            .title("My Alert Rule Folder")
            .build());

        var myAlertRule = new RuleGroup("myAlertRule", RuleGroupArgs.builder()
            .name("My Rule Group")
            .folderUid(ruleFolder.uid())
            .intervalSeconds(240)
            .orgId(1)
            .rules(RuleGroupRuleArgs.builder()
                .name("My Alert Rule 1")
                .for_("2m")
                .condition("B")
                .noDataState("NoData")
                .execErrState("Alerting")
                .annotations(Map.ofEntries(
                    Map.entry("a", "b"),
                    Map.entry("c", "d")
                ))
                .labels(Map.ofEntries(
                    Map.entry("e", "f"),
                    Map.entry("g", "h")
                ))
                .isPaused(false)
                .datas(                
                    RuleGroupRuleDataArgs.builder()
                        .refId("A")
                        .queryType("")
                        .relativeTimeRange(RuleGroupRuleDataRelativeTimeRangeArgs.builder()
                            .from(600)
                            .to(0)
                            .build())
                        .datasourceUid("PD8C576611E62080A")
                        .model(serializeJson(
                            jsonObject(
                                jsonProperty("hide", false),
                                jsonProperty("intervalMs", 1000),
                                jsonProperty("maxDataPoints", 43200),
                                jsonProperty("refId", "A")
                            )))
                        .build(),
                    RuleGroupRuleDataArgs.builder()
                        .refId("B")
                        .queryType("")
                        .relativeTimeRange(RuleGroupRuleDataRelativeTimeRangeArgs.builder()
                            .from(0)
                            .to(0)
                            .build())
                        .datasourceUid("-100")
                        .model("""
{
    "conditions": [
        {
        "evaluator": {
            "params": [
            3
            ],
            "type": "gt"
        },
        "operator": {
            "type": "and"
        },
        "query": {
            "params": [
            "A"
            ]
        },
        "reducer": {
            "params": [],
            "type": "last"
        },
        "type": "query"
        }
    ],
    "datasource": {
        "type": "__expr__",
        "uid": "-100"
    },
    "hide": false,
    "intervalMs": 1000,
    "maxDataPoints": 43200,
    "refId": "B",
    "type": "classic_conditions"
}
                        """)
                        .build())
                .build())
            .build());

    }
}
Copy
resources:
  ruleFolder:
    type: grafana:oss:Folder
    name: rule_folder
    properties:
      title: My Alert Rule Folder
  myAlertRule:
    type: grafana:alerting:RuleGroup
    name: my_alert_rule
    properties:
      name: My Rule Group
      folderUid: ${ruleFolder.uid}
      intervalSeconds: 240
      orgId: 1
      rules:
        - name: My Alert Rule 1
          for: 2m
          condition: B
          noDataState: NoData
          execErrState: Alerting
          annotations:
            a: b
            c: d
          labels:
            e: f
            g: h
          isPaused: false
          datas:
            - refId: A
              queryType: ""
              relativeTimeRange:
                from: 600
                to: 0
              datasourceUid: PD8C576611E62080A
              model:
                fn::toJSON:
                  hide: false
                  intervalMs: 1000
                  maxDataPoints: 43200
                  refId: A
            - refId: B
              queryType: ""
              relativeTimeRange:
                from: 0
                to: 0
              datasourceUid: '-100'
              model: |
                {
                    "conditions": [
                        {
                        "evaluator": {
                            "params": [
                            3
                            ],
                            "type": "gt"
                        },
                        "operator": {
                            "type": "and"
                        },
                        "query": {
                            "params": [
                            "A"
                            ]
                        },
                        "reducer": {
                            "params": [],
                            "type": "last"
                        },
                        "type": "query"
                        }
                    ],
                    "datasource": {
                        "type": "__expr__",
                        "uid": "-100"
                    },
                    "hide": false,
                    "intervalMs": 1000,
                    "maxDataPoints": 43200,
                    "refId": "B",
                    "type": "classic_conditions"
                }                
Copy

Create RuleGroup Resource

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

Constructor syntax

new RuleGroup(name: string, args: RuleGroupArgs, opts?: CustomResourceOptions);
@overload
def RuleGroup(resource_name: str,
              args: RuleGroupArgs,
              opts: Optional[ResourceOptions] = None)

@overload
def RuleGroup(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              disable_provenance: Optional[bool] = None,
              folder_uid: Optional[str] = None,
              interval_seconds: Optional[int] = None,
              name: Optional[str] = None,
              org_id: Optional[str] = None,
              rules: Optional[Sequence[RuleGroupRuleArgs]] = None)
func NewRuleGroup(ctx *Context, name string, args RuleGroupArgs, opts ...ResourceOption) (*RuleGroup, error)
public RuleGroup(string name, RuleGroupArgs args, CustomResourceOptions? opts = null)
public RuleGroup(String name, RuleGroupArgs args)
public RuleGroup(String name, RuleGroupArgs args, CustomResourceOptions options)
type: grafana:RuleGroup
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. RuleGroupArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. RuleGroupArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. RuleGroupArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. RuleGroupArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. RuleGroupArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

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

FolderUid
This property is required.
Changes to this property will trigger replacement.
string
The UID of the folder that the group belongs to.
IntervalSeconds This property is required. int
The interval, in seconds, at which all rules in the group are evaluated. If a group contains many rules, the rules are evaluated sequentially.
Rules This property is required. List<Pulumiverse.Grafana.Inputs.RuleGroupRule>
The rules within the group.
DisableProvenance bool
Name Changes to this property will trigger replacement. string
The name of the rule group.
OrgId Changes to this property will trigger replacement. string
The Organization ID. If not set, the Org ID defined in the provider block will be used.
FolderUid
This property is required.
Changes to this property will trigger replacement.
string
The UID of the folder that the group belongs to.
IntervalSeconds This property is required. int
The interval, in seconds, at which all rules in the group are evaluated. If a group contains many rules, the rules are evaluated sequentially.
Rules This property is required. []RuleGroupRuleArgs
The rules within the group.
DisableProvenance bool
Name Changes to this property will trigger replacement. string
The name of the rule group.
OrgId Changes to this property will trigger replacement. string
The Organization ID. If not set, the Org ID defined in the provider block will be used.
folderUid
This property is required.
Changes to this property will trigger replacement.
String
The UID of the folder that the group belongs to.
intervalSeconds This property is required. Integer
The interval, in seconds, at which all rules in the group are evaluated. If a group contains many rules, the rules are evaluated sequentially.
rules This property is required. List<RuleGroupRule>
The rules within the group.
disableProvenance Boolean
name Changes to this property will trigger replacement. String
The name of the rule group.
orgId Changes to this property will trigger replacement. String
The Organization ID. If not set, the Org ID defined in the provider block will be used.
folderUid
This property is required.
Changes to this property will trigger replacement.
string
The UID of the folder that the group belongs to.
intervalSeconds This property is required. number
The interval, in seconds, at which all rules in the group are evaluated. If a group contains many rules, the rules are evaluated sequentially.
rules This property is required. RuleGroupRule[]
The rules within the group.
disableProvenance boolean
name Changes to this property will trigger replacement. string
The name of the rule group.
orgId Changes to this property will trigger replacement. string
The Organization ID. If not set, the Org ID defined in the provider block will be used.
folder_uid
This property is required.
Changes to this property will trigger replacement.
str
The UID of the folder that the group belongs to.
interval_seconds This property is required. int
The interval, in seconds, at which all rules in the group are evaluated. If a group contains many rules, the rules are evaluated sequentially.
rules This property is required. Sequence[RuleGroupRuleArgs]
The rules within the group.
disable_provenance bool
name Changes to this property will trigger replacement. str
The name of the rule group.
org_id Changes to this property will trigger replacement. str
The Organization ID. If not set, the Org ID defined in the provider block will be used.
folderUid
This property is required.
Changes to this property will trigger replacement.
String
The UID of the folder that the group belongs to.
intervalSeconds This property is required. Number
The interval, in seconds, at which all rules in the group are evaluated. If a group contains many rules, the rules are evaluated sequentially.
rules This property is required. List<Property Map>
The rules within the group.
disableProvenance Boolean
name Changes to this property will trigger replacement. String
The name of the rule group.
orgId Changes to this property will trigger replacement. String
The Organization ID. If not set, the Org ID defined in the provider block will be used.

Outputs

All input properties are implicitly available as output properties. Additionally, the RuleGroup 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 str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing RuleGroup Resource

Get an existing RuleGroup 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?: RuleGroupState, opts?: CustomResourceOptions): RuleGroup
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        disable_provenance: Optional[bool] = None,
        folder_uid: Optional[str] = None,
        interval_seconds: Optional[int] = None,
        name: Optional[str] = None,
        org_id: Optional[str] = None,
        rules: Optional[Sequence[RuleGroupRuleArgs]] = None) -> RuleGroup
func GetRuleGroup(ctx *Context, name string, id IDInput, state *RuleGroupState, opts ...ResourceOption) (*RuleGroup, error)
public static RuleGroup Get(string name, Input<string> id, RuleGroupState? state, CustomResourceOptions? opts = null)
public static RuleGroup get(String name, Output<String> id, RuleGroupState state, CustomResourceOptions options)
resources:  _:    type: grafana:RuleGroup    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
DisableProvenance bool
FolderUid Changes to this property will trigger replacement. string
The UID of the folder that the group belongs to.
IntervalSeconds int
The interval, in seconds, at which all rules in the group are evaluated. If a group contains many rules, the rules are evaluated sequentially.
Name Changes to this property will trigger replacement. string
The name of the rule group.
OrgId Changes to this property will trigger replacement. string
The Organization ID. If not set, the Org ID defined in the provider block will be used.
Rules List<Pulumiverse.Grafana.Inputs.RuleGroupRule>
The rules within the group.
DisableProvenance bool
FolderUid Changes to this property will trigger replacement. string
The UID of the folder that the group belongs to.
IntervalSeconds int
The interval, in seconds, at which all rules in the group are evaluated. If a group contains many rules, the rules are evaluated sequentially.
Name Changes to this property will trigger replacement. string
The name of the rule group.
OrgId Changes to this property will trigger replacement. string
The Organization ID. If not set, the Org ID defined in the provider block will be used.
Rules []RuleGroupRuleArgs
The rules within the group.
disableProvenance Boolean
folderUid Changes to this property will trigger replacement. String
The UID of the folder that the group belongs to.
intervalSeconds Integer
The interval, in seconds, at which all rules in the group are evaluated. If a group contains many rules, the rules are evaluated sequentially.
name Changes to this property will trigger replacement. String
The name of the rule group.
orgId Changes to this property will trigger replacement. String
The Organization ID. If not set, the Org ID defined in the provider block will be used.
rules List<RuleGroupRule>
The rules within the group.
disableProvenance boolean
folderUid Changes to this property will trigger replacement. string
The UID of the folder that the group belongs to.
intervalSeconds number
The interval, in seconds, at which all rules in the group are evaluated. If a group contains many rules, the rules are evaluated sequentially.
name Changes to this property will trigger replacement. string
The name of the rule group.
orgId Changes to this property will trigger replacement. string
The Organization ID. If not set, the Org ID defined in the provider block will be used.
rules RuleGroupRule[]
The rules within the group.
disable_provenance bool
folder_uid Changes to this property will trigger replacement. str
The UID of the folder that the group belongs to.
interval_seconds int
The interval, in seconds, at which all rules in the group are evaluated. If a group contains many rules, the rules are evaluated sequentially.
name Changes to this property will trigger replacement. str
The name of the rule group.
org_id Changes to this property will trigger replacement. str
The Organization ID. If not set, the Org ID defined in the provider block will be used.
rules Sequence[RuleGroupRuleArgs]
The rules within the group.
disableProvenance Boolean
folderUid Changes to this property will trigger replacement. String
The UID of the folder that the group belongs to.
intervalSeconds Number
The interval, in seconds, at which all rules in the group are evaluated. If a group contains many rules, the rules are evaluated sequentially.
name Changes to this property will trigger replacement. String
The name of the rule group.
orgId Changes to this property will trigger replacement. String
The Organization ID. If not set, the Org ID defined in the provider block will be used.
rules List<Property Map>
The rules within the group.

Supporting Types

RuleGroupRule
, RuleGroupRuleArgs

Datas This property is required. List<Pulumiverse.Grafana.Inputs.RuleGroupRuleData>
A sequence of stages that describe the contents of the rule.
Name This property is required. string
The name of the alert rule.
Annotations Dictionary<string, string>
Key-value pairs of metadata to attach to the alert rule. They add additional information, such as a summary or runbook_url, to help identify and investigate alerts. The dashboardUId and panelId annotations, which link alerts to a panel, must be set together. Defaults to map[].
Condition string
The ref_id of the query node in the data field to use as the alert condition.
ExecErrState string
Describes what state to enter when the rule's query is invalid and the rule cannot be executed. Options are OK, Error, KeepLast, and Alerting. Defaults to Alerting if not set.
For string
The amount of time for which the rule must be breached for the rule to be considered to be Firing. Before this time has elapsed, the rule is only considered to be Pending. Defaults to 0.
IsPaused bool
Sets whether the alert should be paused or not. Defaults to false.
Labels Dictionary<string, string>
Key-value pairs to attach to the alert rule that can be used in matching, grouping, and routing. Defaults to map[].
NoDataState string
Describes what state to enter when the rule's query returns No Data. Options are OK, NoData, KeepLast, and Alerting. Defaults to NoData if not set.
NotificationSettings Pulumiverse.Grafana.Inputs.RuleGroupRuleNotificationSettings
Notification settings for the rule. If specified, it overrides the notification policies. Available since Grafana 10.4, requires feature flag 'alertingSimplifiedRouting' to be enabled.
Record Pulumiverse.Grafana.Inputs.RuleGroupRuleRecord
Settings for a recording rule. Available since Grafana 11.2, requires feature flag 'grafanaManagedRecordingRules' to be enabled.
Uid string
The unique identifier of the alert rule.
Datas This property is required. []RuleGroupRuleData
A sequence of stages that describe the contents of the rule.
Name This property is required. string
The name of the alert rule.
Annotations map[string]string
Key-value pairs of metadata to attach to the alert rule. They add additional information, such as a summary or runbook_url, to help identify and investigate alerts. The dashboardUId and panelId annotations, which link alerts to a panel, must be set together. Defaults to map[].
Condition string
The ref_id of the query node in the data field to use as the alert condition.
ExecErrState string
Describes what state to enter when the rule's query is invalid and the rule cannot be executed. Options are OK, Error, KeepLast, and Alerting. Defaults to Alerting if not set.
For string
The amount of time for which the rule must be breached for the rule to be considered to be Firing. Before this time has elapsed, the rule is only considered to be Pending. Defaults to 0.
IsPaused bool
Sets whether the alert should be paused or not. Defaults to false.
Labels map[string]string
Key-value pairs to attach to the alert rule that can be used in matching, grouping, and routing. Defaults to map[].
NoDataState string
Describes what state to enter when the rule's query returns No Data. Options are OK, NoData, KeepLast, and Alerting. Defaults to NoData if not set.
NotificationSettings RuleGroupRuleNotificationSettings
Notification settings for the rule. If specified, it overrides the notification policies. Available since Grafana 10.4, requires feature flag 'alertingSimplifiedRouting' to be enabled.
Record RuleGroupRuleRecord
Settings for a recording rule. Available since Grafana 11.2, requires feature flag 'grafanaManagedRecordingRules' to be enabled.
Uid string
The unique identifier of the alert rule.
datas This property is required. List<RuleGroupRuleData>
A sequence of stages that describe the contents of the rule.
name This property is required. String
The name of the alert rule.
annotations Map<String,String>
Key-value pairs of metadata to attach to the alert rule. They add additional information, such as a summary or runbook_url, to help identify and investigate alerts. The dashboardUId and panelId annotations, which link alerts to a panel, must be set together. Defaults to map[].
condition String
The ref_id of the query node in the data field to use as the alert condition.
execErrState String
Describes what state to enter when the rule's query is invalid and the rule cannot be executed. Options are OK, Error, KeepLast, and Alerting. Defaults to Alerting if not set.
for_ String
The amount of time for which the rule must be breached for the rule to be considered to be Firing. Before this time has elapsed, the rule is only considered to be Pending. Defaults to 0.
isPaused Boolean
Sets whether the alert should be paused or not. Defaults to false.
labels Map<String,String>
Key-value pairs to attach to the alert rule that can be used in matching, grouping, and routing. Defaults to map[].
noDataState String
Describes what state to enter when the rule's query returns No Data. Options are OK, NoData, KeepLast, and Alerting. Defaults to NoData if not set.
notificationSettings RuleGroupRuleNotificationSettings
Notification settings for the rule. If specified, it overrides the notification policies. Available since Grafana 10.4, requires feature flag 'alertingSimplifiedRouting' to be enabled.
record RuleGroupRuleRecord
Settings for a recording rule. Available since Grafana 11.2, requires feature flag 'grafanaManagedRecordingRules' to be enabled.
uid String
The unique identifier of the alert rule.
datas This property is required. RuleGroupRuleData[]
A sequence of stages that describe the contents of the rule.
name This property is required. string
The name of the alert rule.
annotations {[key: string]: string}
Key-value pairs of metadata to attach to the alert rule. They add additional information, such as a summary or runbook_url, to help identify and investigate alerts. The dashboardUId and panelId annotations, which link alerts to a panel, must be set together. Defaults to map[].
condition string
The ref_id of the query node in the data field to use as the alert condition.
execErrState string
Describes what state to enter when the rule's query is invalid and the rule cannot be executed. Options are OK, Error, KeepLast, and Alerting. Defaults to Alerting if not set.
for string
The amount of time for which the rule must be breached for the rule to be considered to be Firing. Before this time has elapsed, the rule is only considered to be Pending. Defaults to 0.
isPaused boolean
Sets whether the alert should be paused or not. Defaults to false.
labels {[key: string]: string}
Key-value pairs to attach to the alert rule that can be used in matching, grouping, and routing. Defaults to map[].
noDataState string
Describes what state to enter when the rule's query returns No Data. Options are OK, NoData, KeepLast, and Alerting. Defaults to NoData if not set.
notificationSettings RuleGroupRuleNotificationSettings
Notification settings for the rule. If specified, it overrides the notification policies. Available since Grafana 10.4, requires feature flag 'alertingSimplifiedRouting' to be enabled.
record RuleGroupRuleRecord
Settings for a recording rule. Available since Grafana 11.2, requires feature flag 'grafanaManagedRecordingRules' to be enabled.
uid string
The unique identifier of the alert rule.
datas This property is required. Sequence[RuleGroupRuleData]
A sequence of stages that describe the contents of the rule.
name This property is required. str
The name of the alert rule.
annotations Mapping[str, str]
Key-value pairs of metadata to attach to the alert rule. They add additional information, such as a summary or runbook_url, to help identify and investigate alerts. The dashboardUId and panelId annotations, which link alerts to a panel, must be set together. Defaults to map[].
condition str
The ref_id of the query node in the data field to use as the alert condition.
exec_err_state str
Describes what state to enter when the rule's query is invalid and the rule cannot be executed. Options are OK, Error, KeepLast, and Alerting. Defaults to Alerting if not set.
for_ str
The amount of time for which the rule must be breached for the rule to be considered to be Firing. Before this time has elapsed, the rule is only considered to be Pending. Defaults to 0.
is_paused bool
Sets whether the alert should be paused or not. Defaults to false.
labels Mapping[str, str]
Key-value pairs to attach to the alert rule that can be used in matching, grouping, and routing. Defaults to map[].
no_data_state str
Describes what state to enter when the rule's query returns No Data. Options are OK, NoData, KeepLast, and Alerting. Defaults to NoData if not set.
notification_settings RuleGroupRuleNotificationSettings
Notification settings for the rule. If specified, it overrides the notification policies. Available since Grafana 10.4, requires feature flag 'alertingSimplifiedRouting' to be enabled.
record RuleGroupRuleRecord
Settings for a recording rule. Available since Grafana 11.2, requires feature flag 'grafanaManagedRecordingRules' to be enabled.
uid str
The unique identifier of the alert rule.
datas This property is required. List<Property Map>
A sequence of stages that describe the contents of the rule.
name This property is required. String
The name of the alert rule.
annotations Map<String>
Key-value pairs of metadata to attach to the alert rule. They add additional information, such as a summary or runbook_url, to help identify and investigate alerts. The dashboardUId and panelId annotations, which link alerts to a panel, must be set together. Defaults to map[].
condition String
The ref_id of the query node in the data field to use as the alert condition.
execErrState String
Describes what state to enter when the rule's query is invalid and the rule cannot be executed. Options are OK, Error, KeepLast, and Alerting. Defaults to Alerting if not set.
for String
The amount of time for which the rule must be breached for the rule to be considered to be Firing. Before this time has elapsed, the rule is only considered to be Pending. Defaults to 0.
isPaused Boolean
Sets whether the alert should be paused or not. Defaults to false.
labels Map<String>
Key-value pairs to attach to the alert rule that can be used in matching, grouping, and routing. Defaults to map[].
noDataState String
Describes what state to enter when the rule's query returns No Data. Options are OK, NoData, KeepLast, and Alerting. Defaults to NoData if not set.
notificationSettings Property Map
Notification settings for the rule. If specified, it overrides the notification policies. Available since Grafana 10.4, requires feature flag 'alertingSimplifiedRouting' to be enabled.
record Property Map
Settings for a recording rule. Available since Grafana 11.2, requires feature flag 'grafanaManagedRecordingRules' to be enabled.
uid String
The unique identifier of the alert rule.

RuleGroupRuleData
, RuleGroupRuleDataArgs

DatasourceUid This property is required. string
The UID of the datasource being queried, or "-100" if this stage is an expression stage.
Model This property is required. string
Custom JSON data to send to the specified datasource when querying.
RefId This property is required. string
A unique string to identify this query stage within a rule.
RelativeTimeRange This property is required. Pulumiverse.Grafana.Inputs.RuleGroupRuleDataRelativeTimeRange
The time range, relative to when the query is executed, across which to query.
QueryType string
An optional identifier for the type of query being executed. Defaults to ``.
DatasourceUid This property is required. string
The UID of the datasource being queried, or "-100" if this stage is an expression stage.
Model This property is required. string
Custom JSON data to send to the specified datasource when querying.
RefId This property is required. string
A unique string to identify this query stage within a rule.
RelativeTimeRange This property is required. RuleGroupRuleDataRelativeTimeRange
The time range, relative to when the query is executed, across which to query.
QueryType string
An optional identifier for the type of query being executed. Defaults to ``.
datasourceUid This property is required. String
The UID of the datasource being queried, or "-100" if this stage is an expression stage.
model This property is required. String
Custom JSON data to send to the specified datasource when querying.
refId This property is required. String
A unique string to identify this query stage within a rule.
relativeTimeRange This property is required. RuleGroupRuleDataRelativeTimeRange
The time range, relative to when the query is executed, across which to query.
queryType String
An optional identifier for the type of query being executed. Defaults to ``.
datasourceUid This property is required. string
The UID of the datasource being queried, or "-100" if this stage is an expression stage.
model This property is required. string
Custom JSON data to send to the specified datasource when querying.
refId This property is required. string
A unique string to identify this query stage within a rule.
relativeTimeRange This property is required. RuleGroupRuleDataRelativeTimeRange
The time range, relative to when the query is executed, across which to query.
queryType string
An optional identifier for the type of query being executed. Defaults to ``.
datasource_uid This property is required. str
The UID of the datasource being queried, or "-100" if this stage is an expression stage.
model This property is required. str
Custom JSON data to send to the specified datasource when querying.
ref_id This property is required. str
A unique string to identify this query stage within a rule.
relative_time_range This property is required. RuleGroupRuleDataRelativeTimeRange
The time range, relative to when the query is executed, across which to query.
query_type str
An optional identifier for the type of query being executed. Defaults to ``.
datasourceUid This property is required. String
The UID of the datasource being queried, or "-100" if this stage is an expression stage.
model This property is required. String
Custom JSON data to send to the specified datasource when querying.
refId This property is required. String
A unique string to identify this query stage within a rule.
relativeTimeRange This property is required. Property Map
The time range, relative to when the query is executed, across which to query.
queryType String
An optional identifier for the type of query being executed. Defaults to ``.

RuleGroupRuleDataRelativeTimeRange
, RuleGroupRuleDataRelativeTimeRangeArgs

From This property is required. int
The number of seconds in the past, relative to when the rule is evaluated, at which the time range begins.
To This property is required. int
The number of seconds in the past, relative to when the rule is evaluated, at which the time range ends.
From This property is required. int
The number of seconds in the past, relative to when the rule is evaluated, at which the time range begins.
To This property is required. int
The number of seconds in the past, relative to when the rule is evaluated, at which the time range ends.
from This property is required. Integer
The number of seconds in the past, relative to when the rule is evaluated, at which the time range begins.
to This property is required. Integer
The number of seconds in the past, relative to when the rule is evaluated, at which the time range ends.
from This property is required. number
The number of seconds in the past, relative to when the rule is evaluated, at which the time range begins.
to This property is required. number
The number of seconds in the past, relative to when the rule is evaluated, at which the time range ends.
from_ This property is required. int
The number of seconds in the past, relative to when the rule is evaluated, at which the time range begins.
to This property is required. int
The number of seconds in the past, relative to when the rule is evaluated, at which the time range ends.
from This property is required. Number
The number of seconds in the past, relative to when the rule is evaluated, at which the time range begins.
to This property is required. Number
The number of seconds in the past, relative to when the rule is evaluated, at which the time range ends.

RuleGroupRuleNotificationSettings
, RuleGroupRuleNotificationSettingsArgs

ContactPoint This property is required. string
The contact point to route notifications that match this rule to.
GroupBies List<string>
A list of alert labels to group alerts into notifications by. Use the special label ... to group alerts by all labels, effectively disabling grouping. If empty, no grouping is used. If specified, requires labels 'alertname' and 'grafana_folder' to be included.
GroupInterval string
Minimum time interval between two notifications for the same group. Default is 5 minutes.
GroupWait string
Time to wait to buffer alerts of the same group before sending a notification. Default is 30 seconds.
MuteTimings List<string>
A list of mute timing names to apply to alerts that match this policy.
RepeatInterval string
Minimum time interval for re-sending a notification if an alert is still firing. Default is 4 hours.
ContactPoint This property is required. string
The contact point to route notifications that match this rule to.
GroupBies []string
A list of alert labels to group alerts into notifications by. Use the special label ... to group alerts by all labels, effectively disabling grouping. If empty, no grouping is used. If specified, requires labels 'alertname' and 'grafana_folder' to be included.
GroupInterval string
Minimum time interval between two notifications for the same group. Default is 5 minutes.
GroupWait string
Time to wait to buffer alerts of the same group before sending a notification. Default is 30 seconds.
MuteTimings []string
A list of mute timing names to apply to alerts that match this policy.
RepeatInterval string
Minimum time interval for re-sending a notification if an alert is still firing. Default is 4 hours.
contactPoint This property is required. String
The contact point to route notifications that match this rule to.
groupBies List<String>
A list of alert labels to group alerts into notifications by. Use the special label ... to group alerts by all labels, effectively disabling grouping. If empty, no grouping is used. If specified, requires labels 'alertname' and 'grafana_folder' to be included.
groupInterval String
Minimum time interval between two notifications for the same group. Default is 5 minutes.
groupWait String
Time to wait to buffer alerts of the same group before sending a notification. Default is 30 seconds.
muteTimings List<String>
A list of mute timing names to apply to alerts that match this policy.
repeatInterval String
Minimum time interval for re-sending a notification if an alert is still firing. Default is 4 hours.
contactPoint This property is required. string
The contact point to route notifications that match this rule to.
groupBies string[]
A list of alert labels to group alerts into notifications by. Use the special label ... to group alerts by all labels, effectively disabling grouping. If empty, no grouping is used. If specified, requires labels 'alertname' and 'grafana_folder' to be included.
groupInterval string
Minimum time interval between two notifications for the same group. Default is 5 minutes.
groupWait string
Time to wait to buffer alerts of the same group before sending a notification. Default is 30 seconds.
muteTimings string[]
A list of mute timing names to apply to alerts that match this policy.
repeatInterval string
Minimum time interval for re-sending a notification if an alert is still firing. Default is 4 hours.
contact_point This property is required. str
The contact point to route notifications that match this rule to.
group_bies Sequence[str]
A list of alert labels to group alerts into notifications by. Use the special label ... to group alerts by all labels, effectively disabling grouping. If empty, no grouping is used. If specified, requires labels 'alertname' and 'grafana_folder' to be included.
group_interval str
Minimum time interval between two notifications for the same group. Default is 5 minutes.
group_wait str
Time to wait to buffer alerts of the same group before sending a notification. Default is 30 seconds.
mute_timings Sequence[str]
A list of mute timing names to apply to alerts that match this policy.
repeat_interval str
Minimum time interval for re-sending a notification if an alert is still firing. Default is 4 hours.
contactPoint This property is required. String
The contact point to route notifications that match this rule to.
groupBies List<String>
A list of alert labels to group alerts into notifications by. Use the special label ... to group alerts by all labels, effectively disabling grouping. If empty, no grouping is used. If specified, requires labels 'alertname' and 'grafana_folder' to be included.
groupInterval String
Minimum time interval between two notifications for the same group. Default is 5 minutes.
groupWait String
Time to wait to buffer alerts of the same group before sending a notification. Default is 30 seconds.
muteTimings List<String>
A list of mute timing names to apply to alerts that match this policy.
repeatInterval String
Minimum time interval for re-sending a notification if an alert is still firing. Default is 4 hours.

RuleGroupRuleRecord
, RuleGroupRuleRecordArgs

From This property is required. string
The ref id of the query node in the data field to use as the source of the metric.
Metric This property is required. string
The name of the metric to write to.
From This property is required. string
The ref id of the query node in the data field to use as the source of the metric.
Metric This property is required. string
The name of the metric to write to.
from This property is required. String
The ref id of the query node in the data field to use as the source of the metric.
metric This property is required. String
The name of the metric to write to.
from This property is required. string
The ref id of the query node in the data field to use as the source of the metric.
metric This property is required. string
The name of the metric to write to.
from_ This property is required. str
The ref id of the query node in the data field to use as the source of the metric.
metric This property is required. str
The name of the metric to write to.
from This property is required. String
The ref id of the query node in the data field to use as the source of the metric.
metric This property is required. String
The name of the metric to write to.

Import

$ pulumi import grafana:index/ruleGroup:RuleGroup name "{{ folderUID }}:{{ title }}"
Copy
$ pulumi import grafana:index/ruleGroup:RuleGroup name "{{ orgID }}:{{ folderUID }}:{{ title }}"
Copy

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.