UNPKG

@pulumiverse/grafana

Version:

A Pulumi package for creating and managing grafana.

218 lines (217 loc) 7.22 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * Manages Grafana Alerting rule groups. * * * Official documentation * * [HTTP API](https://grafana.com/docs/grafana/latest/developer-resources/api-reference/http-api/api-legacy/alerting_provisioning/#alert-rules) * * This resource requires Grafana 9.1.0 or later. * * ## Example Usage * * ```typescript * 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\\" * } * `, * }, * ], * }], * }); * ``` * * ## Import * * ```sh * terraform import grafana_rule_group.name "{{ folderUID }}:{{ title }}" * terraform import grafana_rule_group.name "{{ orgID }}:{{ folderUID }}:{{ title }}" * ``` */ export declare class RuleGroup extends pulumi.CustomResource { /** * Get an existing RuleGroup resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input<pulumi.ID>, state?: RuleGroupState, opts?: pulumi.CustomResourceOptions): RuleGroup; /** * Returns true if the given object is an instance of RuleGroup. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is RuleGroup; /** * Allow modifying the rule group from other sources than Terraform or the Grafana API. Defaults to `false`. */ readonly disableProvenance: pulumi.Output<boolean | undefined>; /** * The UID of the folder that the group belongs to. */ readonly folderUid: pulumi.Output<string>; /** * The interval, in seconds, at which all rules in the group are evaluated. If a group contains many rules, the rules are evaluated sequentially. */ readonly intervalSeconds: pulumi.Output<number>; /** * The name of the rule group. */ readonly name: pulumi.Output<string>; /** * The Organization ID. If not set, the Org ID defined in the provider block will be used. */ readonly orgId: pulumi.Output<string | undefined>; /** * The rules within the group. */ readonly rules: pulumi.Output<outputs.alerting.RuleGroupRule[]>; /** * Create a RuleGroup resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: RuleGroupArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering RuleGroup resources. */ export interface RuleGroupState { /** * Allow modifying the rule group from other sources than Terraform or the Grafana API. Defaults to `false`. */ disableProvenance?: pulumi.Input<boolean>; /** * The UID of the folder that the group belongs to. */ folderUid?: pulumi.Input<string>; /** * The interval, in seconds, at which all rules in the group are evaluated. If a group contains many rules, the rules are evaluated sequentially. */ intervalSeconds?: pulumi.Input<number>; /** * The name of the rule group. */ name?: pulumi.Input<string>; /** * The Organization ID. If not set, the Org ID defined in the provider block will be used. */ orgId?: pulumi.Input<string>; /** * The rules within the group. */ rules?: pulumi.Input<pulumi.Input<inputs.alerting.RuleGroupRule>[]>; } /** * The set of arguments for constructing a RuleGroup resource. */ export interface RuleGroupArgs { /** * Allow modifying the rule group from other sources than Terraform or the Grafana API. Defaults to `false`. */ disableProvenance?: pulumi.Input<boolean>; /** * The UID of the folder that the group belongs to. */ folderUid: pulumi.Input<string>; /** * The interval, in seconds, at which all rules in the group are evaluated. If a group contains many rules, the rules are evaluated sequentially. */ intervalSeconds: pulumi.Input<number>; /** * The name of the rule group. */ name?: pulumi.Input<string>; /** * The Organization ID. If not set, the Org ID defined in the provider block will be used. */ orgId?: pulumi.Input<string>; /** * The rules within the group. */ rules: pulumi.Input<pulumi.Input<inputs.alerting.RuleGroupRule>[]>; }