<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Grafana resources and Terraform on Grafana Labs</title><link>https://grafana.com/docs/learning-hub/resources-as-code/02-terraform-fundamentals/</link><description>Recent content in Grafana resources and Terraform on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/learning-hub/resources-as-code/02-terraform-fundamentals/index.xml" rel="self" type="application/rss+xml"/><item><title>Grafana resources and Terraform</title><link>https://grafana.com/docs/learning-hub/resources-as-code/02-terraform-fundamentals/00-module-intro/</link><pubDate>Wed, 15 Jul 2026 16:12:13 +0200</pubDate><guid>https://grafana.com/docs/learning-hub/resources-as-code/02-terraform-fundamentals/00-module-intro/</guid><content><![CDATA[&lt;h2 id=&#34;grafana-resources-and-terraform&#34;&gt;Grafana resources and Terraform&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;What you&amp;rsquo;ll do in this module:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Resources as code in Grafana.&lt;/strong&gt; What it means to define Grafana resources in configuration files instead of the UI.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Grafana resources in Terraform.&lt;/strong&gt; The Grafana Terraform provider and the resources it supports.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Anatomy of an alert rule.&lt;/strong&gt; How a Grafana alert rule maps to a Terraform resource block.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The alerting pipeline.&lt;/strong&gt; How alert rules, contact points, and notification policies work together.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Deploy an alert rule learning path.&lt;/strong&gt; Hands-on deployment of a complete alerting pipeline.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Estimated time:&lt;/strong&gt; 15 minutes&lt;/p&gt;
]]></content><description>&lt;h2 id="grafana-resources-and-terraform">Grafana resources and Terraform&lt;/h2>
&lt;p>&lt;strong>What you&amp;rsquo;ll do in this module:&lt;/strong>&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Resources as code in Grafana.&lt;/strong> What it means to define Grafana resources in configuration files instead of the UI.&lt;/li>
&lt;li>&lt;strong>Grafana resources in Terraform.&lt;/strong> The Grafana Terraform provider and the resources it supports.&lt;/li>
&lt;li>&lt;strong>Anatomy of an alert rule.&lt;/strong> How a Grafana alert rule maps to a Terraform resource block.&lt;/li>
&lt;li>&lt;strong>The alerting pipeline.&lt;/strong> How alert rules, contact points, and notification policies work together.&lt;/li>
&lt;li>&lt;strong>Deploy an alert rule learning path.&lt;/strong> Hands-on deployment of a complete alerting pipeline.&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>Estimated time:&lt;/strong> 15 minutes&lt;/p></description></item><item><title>Resources as code in Grafana</title><link>https://grafana.com/docs/learning-hub/resources-as-code/02-terraform-fundamentals/01-resources-as-code/</link><pubDate>Wed, 15 Jul 2026 16:12:13 +0200</pubDate><guid>https://grafana.com/docs/learning-hub/resources-as-code/02-terraform-fundamentals/01-resources-as-code/</guid><content><![CDATA[&lt;h2 id=&#34;what-resources-as-code-means&#34;&gt;What &amp;ldquo;resources as code&amp;rdquo; means&lt;/h2&gt;
&lt;p&gt;When you manage Grafana resources as code, you define them in configuration files instead of configuring them through the UI. Those files live in version control, go through code review, and deploy through a pipeline.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Manual (UI)&lt;/th&gt;
              &lt;th&gt;As code (Terraform)&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;Click through forms to create an alert rule&lt;/td&gt;
              &lt;td&gt;Write an HCL block that defines the rule&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Changes aren&amp;rsquo;t tracked&lt;/td&gt;
              &lt;td&gt;Every change is a Git commit&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Hard to replicate across environments&lt;/td&gt;
              &lt;td&gt;Same code deploys to staging and production&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;No review process&lt;/td&gt;
              &lt;td&gt;Pull requests catch mistakes before they reach Grafana&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;what-resources-can-you-manage&#34;&gt;What resources can you manage?&lt;/h2&gt;
&lt;p&gt;Grafana isn&amp;rsquo;t just dashboards. You can manage a wide range of resources across the entire Grafana ecosystem as code.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Category&lt;/th&gt;
              &lt;th&gt;Examples&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Visualization&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Dashboards, folders, library panels, playlists&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Alerting&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Alert rule groups, contact points, notification policies, mute timings, message templates&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Data&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Data sources, data source permissions&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Access control&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Service accounts, teams, users, roles, RBAC&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Platform&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Organizations, SLOs, plugins, annotations&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Grafana Cloud&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Cloud stacks, access policies, Fleet Management, IRM/OnCall&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;]]></content><description>&lt;h2 id="what-resources-as-code-means">What &amp;ldquo;resources as code&amp;rdquo; means&lt;/h2>
&lt;p>When you manage Grafana resources as code, you define them in configuration files instead of configuring them through the UI. Those files live in version control, go through code review, and deploy through a pipeline.&lt;/p></description></item><item><title>Grafana resources in Terraform</title><link>https://grafana.com/docs/learning-hub/resources-as-code/02-terraform-fundamentals/02-terraform-resources/</link><pubDate>Wed, 15 Jul 2026 16:12:13 +0200</pubDate><guid>https://grafana.com/docs/learning-hub/resources-as-code/02-terraform-fundamentals/02-terraform-resources/</guid><content><![CDATA[&lt;h2 id=&#34;the-grafana-terraform-provider&#34;&gt;The Grafana Terraform provider&lt;/h2&gt;
&lt;p&gt;Terraform uses HashiCorp Configuration Language (HCL), an open-source toolkit to define infrastructure and resources as code.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&#34;https://registry.terraform.io/providers/grafana/grafana/latest/docs&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Grafana Terraform provider&lt;/a&gt; is the bridge between your Terraform configuration and the Grafana API. It handles authentication, resource lifecycle management, and state tracking. You declare it in your configuration and authenticate with your Grafana instance URL and a service account token.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;hcl&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-hcl&#34;&gt;terraform {
  required_providers {
    grafana = {
      source  = &amp;#34;grafana/grafana&amp;#34;
      version = &amp;#34;&amp;gt;= 2.9.0&amp;#34;
    }
  }
}

provider &amp;#34;grafana&amp;#34; {
  url  = var.grafana_url
  auth = var.grafana_token
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;core-grafana-infrastructure-resources-with-terraform&#34;&gt;Core Grafana infrastructure resources with Terraform&lt;/h2&gt;
&lt;p&gt;The provider manages a wide range of resources. These are the some of the resources used for a Grafana instance.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Terraform resource&lt;/th&gt;
              &lt;th&gt;What it manages&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;grafana_dashboard&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Dashboard definitions from JSON&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;grafana_folder&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Organizational folders for dashboards and alerts&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;grafana_data_source&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Connections to Prometheus, Loki, Tempo, and other backends&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;grafana_library_panel&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Reusable panels shared across dashboards&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;grafana_organization&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Grafana organizations (self-managed only)&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;grafana_service_account&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;API credentials for automated tools&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;grafana_team&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Team definitions and memberships&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;grafana_slo&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Service Level Objectives with burn rate alerting&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;grafana-cloud-resources-with-terraform&#34;&gt;Grafana Cloud resources with Terraform&lt;/h2&gt;
&lt;p&gt;For Grafana Cloud, additional resources manage stack-level configuration.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Terraform resource&lt;/th&gt;
              &lt;th&gt;What it manages&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;grafana_cloud_stack&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Grafana Cloud stack provisioning&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;grafana_cloud_access_policy&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Cloud access policies and tokens&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;grafana_cloud_stack_service_account&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Service accounts scoped to a Cloud stack&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;]]></content><description>&lt;h2 id="the-grafana-terraform-provider">The Grafana Terraform provider&lt;/h2>
&lt;p>Terraform uses HashiCorp Configuration Language (HCL), an open-source toolkit to define infrastructure and resources as code.&lt;/p>
&lt;p>The &lt;a href="https://registry.terraform.io/providers/grafana/grafana/latest/docs" target="_blank" rel="noopener noreferrer">Grafana Terraform provider&lt;/a> is the bridge between your Terraform configuration and the Grafana API. It handles authentication, resource lifecycle management, and state tracking. You declare it in your configuration and authenticate with your Grafana instance URL and a service account token.&lt;/p></description></item><item><title>Anatomy of an alert rule in Terraform</title><link>https://grafana.com/docs/learning-hub/resources-as-code/02-terraform-fundamentals/03-alerting-resources/</link><pubDate>Wed, 15 Jul 2026 16:12:13 +0200</pubDate><guid>https://grafana.com/docs/learning-hub/resources-as-code/02-terraform-fundamentals/03-alerting-resources/</guid><content><![CDATA[&lt;h2 id=&#34;alerting-resources&#34;&gt;Alerting resources&lt;/h2&gt;
&lt;p&gt;Grafana alerting resources in Terraform include:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Terraform resource&lt;/th&gt;
              &lt;th&gt;What it manages&lt;/th&gt;
              &lt;th&gt;Key attributes&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;grafana_rule_group&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;A group of alert rules with shared evaluation interval&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;name&lt;/code&gt;, &lt;code&gt;folder_uid&lt;/code&gt;, &lt;code&gt;interval_seconds&lt;/code&gt;, &lt;code&gt;rule&lt;/code&gt; blocks&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;grafana_contact_point&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Notification destinations (email, Slack, PagerDuty, webhooks)&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;name&lt;/code&gt;, integration-specific blocks (&lt;code&gt;email&lt;/code&gt;, &lt;code&gt;slack&lt;/code&gt;, etc.)&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;grafana_notification_policy&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Routing rules that match alerts to contact points&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;contact_point&lt;/code&gt;, &lt;code&gt;group_by&lt;/code&gt;, &lt;code&gt;matcher&lt;/code&gt; blocks&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;grafana_mute_timing&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Time windows when notifications are suppressed&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;name&lt;/code&gt;, &lt;code&gt;intervals&lt;/code&gt; with days, months, times&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;grafana_message_template&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Reusable Go templates for notification content&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;name&lt;/code&gt;, &lt;code&gt;template&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;An alert rule defines what to watch, what &amp;ldquo;bad&amp;rdquo; looks like, and how often to check. In other words, it tells Grafana when something is wrong. Contact points and notification policies tell it what to do about it. Together, these three resources form a complete alerting pipeline.&lt;/p&gt;
&lt;h2 id=&#34;alert-rule-group&#34;&gt;Alert rule group&lt;/h2&gt;
&lt;p&gt;In Terraform, alert rules live inside a rule group. A rule group is a named collection of related rules that share the same evaluation interval and folder.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Concept&lt;/th&gt;
              &lt;th&gt;What it is&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Alert rule&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;The instructions you give Grafana: what to watch, what &amp;ldquo;bad&amp;rdquo; looks like, how often to check&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Rule group&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;A named collection of related alert rules that share the same evaluation interval and folder&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Evaluation interval&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;How often Grafana checks the rule&amp;rsquo;s condition&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Condition&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;An expression that reduces query results to a single value and compares it against a threshold&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;example-a-cpu-usage-alert&#34;&gt;Example: a CPU usage alert&lt;/h2&gt;
&lt;p&gt;This HCL block defines a rule group with one alert rule that fires when CPU usage exceeds 80%.&lt;/p&gt;
&lt;p&gt;The data blocks form a pipeline: the first block (A) queries the metric, the second (B) reduces the result to a single value, and the third (C) compares that value against a threshold. Blocks B and C use &lt;code&gt;datasource_uid = &amp;quot;__expr__&amp;quot;&lt;/code&gt;, which is Grafana&amp;rsquo;s built-in server-side expression engine for transforming and evaluating query results without a separate data source. The &lt;code&gt;condition&lt;/code&gt; field on the rule points to the final data block (C), which determines when the alert fires.&lt;/p&gt;
&lt;p&gt;Labels on the rule, like &lt;code&gt;severity = &amp;quot;warning&amp;quot;&lt;/code&gt;, control how notifications are routed. The notification policy you&amp;rsquo;ll define in the next slide matches on these labels to decide which contact point receives the alert.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;hcl&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-hcl&#34;&gt;resource &amp;#34;grafana_rule_group&amp;#34; &amp;#34;cpu_alerts&amp;#34; {
  name             = &amp;#34;CPU alerts&amp;#34;
  folder_uid       = grafana_folder.alerts.uid
  interval_seconds = 60

  rule {
    name      = &amp;#34;High CPU usage&amp;#34;
    condition = &amp;#34;C&amp;#34;

    data {
      ref_id         = &amp;#34;A&amp;#34;
      datasource_uid = &amp;#34;prometheus&amp;#34;

      relative_time_range {
        from = 600
        to   = 0
      }

      model = jsonencode({
        expr = &amp;#34;100 - (avg(rate(node_cpu_seconds_total{mode=\&amp;#34;idle\&amp;#34;}[5m])) * 100)&amp;#34;
      })
    }

    data {
      ref_id         = &amp;#34;B&amp;#34;
      datasource_uid = &amp;#34;__expr__&amp;#34;

      relative_time_range {
        from = 0
        to   = 0
      }

      model = jsonencode({
        type       = &amp;#34;reduce&amp;#34;
        expression = &amp;#34;A&amp;#34;
        reducer    = &amp;#34;last&amp;#34;
      })
    }

    data {
      ref_id         = &amp;#34;C&amp;#34;
      datasource_uid = &amp;#34;__expr__&amp;#34;

      relative_time_range {
        from = 0
        to   = 0
      }

      model = jsonencode({
        type       = &amp;#34;threshold&amp;#34;
        expression = &amp;#34;B&amp;#34;
        conditions = [{
          evaluator = {
            type   = &amp;#34;gt&amp;#34;
            params = [80]
          }
        }]
      })
    }

    labels = {
      severity = &amp;#34;warning&amp;#34;
    }
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h2 id="alerting-resources">Alerting resources&lt;/h2>
&lt;p>Grafana alerting resources in Terraform include:&lt;/p>
&lt;section class="expand-table-wrapper">&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Terraform resource&lt;/th>
&lt;th>What it manages&lt;/th>
&lt;th>Key attributes&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;code>grafana_rule_group&lt;/code>&lt;/td>
&lt;td>A group of alert rules with shared evaluation interval&lt;/td>
&lt;td>&lt;code>name&lt;/code>, &lt;code>folder_uid&lt;/code>, &lt;code>interval_seconds&lt;/code>, &lt;code>rule&lt;/code> blocks&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>grafana_contact_point&lt;/code>&lt;/td>
&lt;td>Notification destinations (email, Slack, PagerDuty, webhooks)&lt;/td>
&lt;td>&lt;code>name&lt;/code>, integration-specific blocks (&lt;code>email&lt;/code>, &lt;code>slack&lt;/code>, etc.)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>grafana_notification_policy&lt;/code>&lt;/td>
&lt;td>Routing rules that match alerts to contact points&lt;/td>
&lt;td>&lt;code>contact_point&lt;/code>, &lt;code>group_by&lt;/code>, &lt;code>matcher&lt;/code> blocks&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>grafana_mute_timing&lt;/code>&lt;/td>
&lt;td>Time windows when notifications are suppressed&lt;/td>
&lt;td>&lt;code>name&lt;/code>, &lt;code>intervals&lt;/code> with days, months, times&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>grafana_message_template&lt;/code>&lt;/td>
&lt;td>Reusable Go templates for notification content&lt;/td>
&lt;td>&lt;code>name&lt;/code>, &lt;code>template&lt;/code>&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;p>An alert rule defines what to watch, what &amp;ldquo;bad&amp;rdquo; looks like, and how often to check. In other words, it tells Grafana when something is wrong. Contact points and notification policies tell it what to do about it. Together, these three resources form a complete alerting pipeline.&lt;/p></description></item><item><title>Alerting pipeline in Terraform</title><link>https://grafana.com/docs/learning-hub/resources-as-code/02-terraform-fundamentals/04-alerting-pipeline/</link><pubDate>Wed, 15 Jul 2026 16:12:13 +0200</pubDate><guid>https://grafana.com/docs/learning-hub/resources-as-code/02-terraform-fundamentals/04-alerting-pipeline/</guid><content><![CDATA[&lt;h2 id=&#34;how-the-alerting-pipeline-works&#34;&gt;How the alerting pipeline works&lt;/h2&gt;
&lt;p&gt;The notification policy tree starts with a default route. All alerts enter at the top and flow down through nested policies until they match. The first matching policy determines which contact point receives the notification.&lt;/p&gt;
&lt;p&gt;Labels on the alert rule, like &lt;code&gt;severity = &amp;quot;warning&amp;quot;&lt;/code&gt;, are what the notification policy matches against. This is why consistent labeling matters: it&amp;rsquo;s the contract between your alert rules and your notification routing.&lt;/p&gt;
&lt;h2 id=&#34;example-a-slack-contact-point&#34;&gt;Example: a Slack contact point&lt;/h2&gt;
&lt;p&gt;A contact point defines a notification destination. This example sends alerts to a Slack channel.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;hcl&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-hcl&#34;&gt;resource &amp;#34;grafana_contact_point&amp;#34; &amp;#34;slack_alerts&amp;#34; {
  name = &amp;#34;Slack alerts&amp;#34;

  slack {
    url     = var.slack_webhook_url
    title   = &amp;#34;{{ .CommonLabels.alertname }}&amp;#34;
    text    = &amp;#34;{{ .CommonAnnotations.description }}&amp;#34;
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;example-a-notification-policy&#34;&gt;Example: a notification policy&lt;/h2&gt;
&lt;p&gt;A notification policy routes alerts to contact points based on label matching. This example routes critical alerts to PagerDuty and everything else to Slack.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;hcl&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-hcl&#34;&gt;resource &amp;#34;grafana_notification_policy&amp;#34; &amp;#34;main&amp;#34; {
  contact_point = grafana_contact_point.slack_alerts.name
  group_by      = [&amp;#34;alertname&amp;#34;]

  policy {
    matcher {
      label = &amp;#34;severity&amp;#34;
      match = &amp;#34;=&amp;#34;
      value = &amp;#34;critical&amp;#34;
    }
    contact_point = grafana_contact_point.pagerduty.name
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h2 id="how-the-alerting-pipeline-works">How the alerting pipeline works&lt;/h2>
&lt;p>The notification policy tree starts with a default route. All alerts enter at the top and flow down through nested policies until they match. The first matching policy determines which contact point receives the notification.&lt;/p></description></item><item><title>Deploy an alert rule learning path</title><link>https://grafana.com/docs/learning-hub/resources-as-code/02-terraform-fundamentals/05-deploy-alert-path/</link><pubDate>Wed, 15 Jul 2026 16:12:13 +0200</pubDate><guid>https://grafana.com/docs/learning-hub/resources-as-code/02-terraform-fundamentals/05-deploy-alert-path/</guid><content><![CDATA[&lt;h2 id=&#34;learning-path-deploy-an-alert-rule-with-terraform&#34;&gt;Learning path: Deploy an alert rule with Terraform&lt;/h2&gt;
&lt;p&gt;The following table describes the steps you&amp;rsquo;ll work through in the learning path.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Step&lt;/th&gt;
              &lt;th&gt;What you&amp;rsquo;ll do&lt;/th&gt;
              &lt;th&gt;Outcome&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;1. Why Terraform?&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Understand why Terraform is a natural fit for deploying alerting resources&lt;/td&gt;
              &lt;td&gt;Context for choosing Terraform over manual workflows&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;2. Create a service account&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Set up API credentials in Grafana for Terraform&lt;/td&gt;
              &lt;td&gt;A service account token for authentication&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;3. Configure the provider&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Declare the Grafana Terraform provider and authenticate&lt;/td&gt;
              &lt;td&gt;Terraform connected to your Grafana instance&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;4. Define a folder and an alert rule group&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Create a folder to organize your alert rules, anda &lt;code&gt;grafana_rule_group&lt;/code&gt; with a CPU usage alert&lt;/td&gt;
              &lt;td&gt;An organizational folder and alert rule ready to deploy in Grafana&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;5. Add a contact point&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Define a &lt;code&gt;grafana_contact_point&lt;/code&gt; for Slack or email&lt;/td&gt;
              &lt;td&gt;A notification destination configured&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;6. Add a notification policy&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Route alerts to the contact point based on labels&lt;/td&gt;
              &lt;td&gt;A complete alerting pipeline&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;7. Run terraform plan&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Preview what Terraform will create in Grafana&lt;/td&gt;
              &lt;td&gt;Confidence in what will change before applying&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;8. Apply and verify&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Run &lt;code&gt;terraform apply&lt;/code&gt; and confirm the resources appear in Grafana&lt;/td&gt;
              &lt;td&gt;A live alerting pipeline deployed from code&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;before-you-start&#34;&gt;Before you start&lt;/h2&gt;
&lt;p&gt;Have these ready before you open the path:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A Grafana Cloud account or self-managed Grafana instance (version 12 or higher)&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.terraform.io/downloads&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Terraform&lt;/a&gt; installed (version 1.0 or later)&lt;/li&gt;
&lt;li&gt;A data source configured in Grafana (for example, Prometheus or Grafana TestData)&lt;/li&gt;
&lt;li&gt;Admin or Editor permissions on your Grafana instance&lt;/li&gt;
&lt;/ul&gt;









  
  
&lt;div class=&#34;learning-path-card&#34;&gt;
  




  
  
    
  


&lt;div class=&#34;pathway-row__label mb-1&#34;&gt;
  
  &lt;svg width=&#34;40&#34; height=&#34;40&#34; viewBox=&#34;0 0 40 40&#34; fill=&#34;none&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;&lt;rect x=&#34;0.5&#34; y=&#34;0.5&#34; width=&#34;39&#34; height=&#34;39&#34; rx=&#34;3.5&#34; fill=&#34;white&#34; stroke=&#34;#D8D8DF&#34;&gt;&lt;/rect&gt;&lt;path d=&#34;M8 20H14C16.5 20 18.5 18 18.5 15.5V12&#34; stroke=&#34;#FF671D&#34; stroke-width=&#34;2&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;&gt;&lt;/path&gt;&lt;path d=&#34;M8 20H14C16.5 20 18.5 22 18.5 24.5V28&#34; stroke=&#34;#FF671D&#34; stroke-width=&#34;2&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;&gt;&lt;/path&gt;&lt;path d=&#34;M14 20H32&#34; stroke=&#34;#FF671D&#34; stroke-width=&#34;2&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;&gt;&lt;/path&gt;&lt;circle cx=&#34;18.5&#34; cy=&#34;12&#34; r=&#34;2&#34; stroke=&#34;#FF671D&#34; stroke-width=&#34;2&#34; fill=&#34;white&#34;&gt;&lt;/circle&gt;&lt;circle cx=&#34;18.5&#34; cy=&#34;28&#34; r=&#34;2&#34; stroke=&#34;#FF671D&#34; stroke-width=&#34;2&#34; fill=&#34;white&#34;&gt;&lt;/circle&gt;&lt;path d=&#34;M29 17L32 20L29 23&#34; stroke=&#34;#FF671D&#34; stroke-width=&#34;2&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;&gt;&lt;/path&gt;&lt;/svg&gt;

  Learning path
&lt;/div&gt;

&lt;h4&gt;Deploy an alert rule with Terraform&lt;/h4&gt;
&lt;p&gt;Deploy a complete Grafana alerting pipeline using the Terraform provider.&lt;/p&gt;

&lt;div class=&#34;d-sm-flex gap-half mb-2&#34;&gt;
  &lt;div class=&#34;d-flex align-items-center gap-half text-gray-12 mt-half body-small&#34;&gt;
    &lt;div class=&#34;journey-list__icon&#34;&gt;
  &lt;svg width=&#34;24&#34; height=&#34;24&#34; viewBox=&#34;0 0 24 24&#34; fill=&#34;none&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
  &lt;path fill-rule=&#34;evenodd&#34; clip-rule=&#34;evenodd&#34; d=&#34;M11.9995 22.5039C17.7985 22.5039 22.4995 17.8029 22.4995 12.0039C22.4995 6.20492 17.7985 1.50391 11.9995 1.50391C6.20052 1.50391 1.49951 6.20492 1.49951 12.0039C1.49951 17.8029 6.20052 22.5039 11.9995 22.5039Z&#34; stroke=&#34;#FF671D&#34; stroke-width=&#34;1.5&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
  &lt;path d=&#34;M11.9995 12.0039V8.25391&#34; stroke=&#34;#FF671D&#34; stroke-width=&#34;1.5&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
  &lt;path d=&#34;M11.9995 12.0078L16.6865 16.6958&#34; stroke=&#34;#FF671D&#34; stroke-width=&#34;1.5&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
&lt;/svg&gt;
&lt;/div&gt;
    &lt;span&gt;17 min&lt;/span&gt;
  &lt;/div&gt;
  
  &lt;div class=&#34;d-flex align-items-center gap-half text-gray-12 mt-half body-small&#34;&gt;
    &lt;div class=&#34;journey-list__icon&#34;&gt;
  &lt;svg width=&#34;24&#34; height=&#34;25&#34; viewBox=&#34;0 0 24 25&#34; fill=&#34;none&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
  &lt;path fill-rule=&#34;evenodd&#34; clip-rule=&#34;evenodd&#34; d=&#34;M0.75 9.83984C0.75 7.6307 2.54086 5.83984 4.75 5.83984H19.25C21.4591 5.83984 23.25 7.6307 23.25 9.83984V19.1198C23.25 21.329 21.4591 23.1198 19.25 23.1198H4.75C2.54086 23.1198 0.75 21.329 0.75 19.1198V9.83984Z&#34; stroke=&#34;#FF671D&#34; stroke-width=&#34;1.5&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
  &lt;path fill-rule=&#34;evenodd&#34; clip-rule=&#34;evenodd&#34; d=&#34;M14.25 1.52344H9.75C8.92157 1.52344 8.25 2.16815 8.25 2.96344V5.84344H15.75V2.96344C15.75 2.16815 15.0784 1.52344 14.25 1.52344Z&#34; stroke=&#34;#FF671D&#34; stroke-width=&#34;1.5&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
  &lt;path fill-rule=&#34;evenodd&#34; clip-rule=&#34;evenodd&#34; d=&#34;M12 15.923C12.8284 15.923 13.5 15.2783 13.5 14.483C13.5 13.6877 12.8284 13.043 12 13.043C11.1716 13.043 10.5 13.6877 10.5 14.483C10.5 15.2783 11.1716 15.923 12 15.923Z&#34; stroke=&#34;#FF671D&#34; stroke-width=&#34;1.5&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
  &lt;path fill-rule=&#34;evenodd&#34; clip-rule=&#34;evenodd&#34; d=&#34;M13.2742 8.91315L13.7162 10.309C13.8671 10.7897 14.3806 11.0756 14.8902 10.9628L16.3622 10.6354C16.9349 10.5115 17.5249 10.7602 17.8175 11.2488C18.11 11.7374 18.037 12.3519 17.6372 12.7647L16.6062 13.8312C16.2493 14.1997 16.2493 14.7703 16.6062 15.1388L17.6372 16.2053C18.0379 16.6179 18.1115 17.2331 17.8188 17.7222C17.526 18.2113 16.9353 18.4601 16.3622 18.3356L14.8902 18.0082C14.3806 17.8953 13.8671 18.1812 13.7162 18.662L13.2742 20.0559C13.1055 20.5961 12.5877 20.9661 12.0002 20.9661C11.4128 20.9661 10.8949 20.5961 10.7262 20.0559L10.2842 18.661C10.1333 18.1803 9.61982 17.8944 9.11021 18.0072L7.63821 18.3346C7.06469 18.4597 6.47325 18.2109 6.18034 17.7213C5.88742 17.2317 5.96161 16.6159 6.36321 16.2034L7.39421 15.1368C7.75116 14.7684 7.75116 14.1978 7.39421 13.8293L6.36321 12.7628C5.96346 12.35 5.89039 11.7354 6.18296 11.2468C6.47553 10.7582 7.06551 10.5096 7.63821 10.6335L9.11021 10.9608C9.61923 11.0739 10.1324 10.7889 10.2842 10.309L10.7262 8.91507C10.8944 8.37473 11.412 8.00435 11.9995 8.00391C12.5869 8.00346 13.1051 8.37307 13.2742 8.91315V8.91315Z&#34; stroke=&#34;#FF671D&#34; stroke-width=&#34;1.5&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
&lt;/svg&gt;
&lt;/div&gt;
    &lt;span&gt;Advanced&lt;/span&gt;
  &lt;/div&gt;
  
  
  &lt;div class=&#34;d-flex align-items-center gap-half text-gray-12 mt-half body-small&#34;&gt;
    &lt;div class=&#34;journey-list__icon&#34;&gt;
  &lt;svg width=&#34;24&#34; height=&#34;24&#34; viewBox=&#34;0 0 24 24&#34; fill=&#34;none&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
  &lt;path fill-rule=&#34;evenodd&#34; clip-rule=&#34;evenodd&#34; d=&#34;M0.75 2.75C0.75 1.64543 1.64543 0.75 2.75 0.75H21.25C22.3546 0.75 23.25 1.64543 23.25 2.75V21.25C23.25 22.3546 22.3546 23.25 21.25 23.25H2.75C1.64543 23.25 0.75 22.3546 0.75 21.25V2.75Z&#34; stroke=&#34;#FF671D&#34; stroke-width=&#34;1.5&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
  &lt;path d=&#34;M12 4.5L7.5 10.5L4.5 7.5&#34; stroke=&#34;#FF671D&#34; stroke-width=&#34;1.5&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
  &lt;path d=&#34;M14.25 8.25H18.75&#34; stroke=&#34;#FF671D&#34; stroke-width=&#34;1.5&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
  &lt;path d=&#34;M12 13.5L7.5 19.5L4.5 16.5&#34; stroke=&#34;#FF671D&#34; stroke-width=&#34;1.5&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
  &lt;path d=&#34;M14.25 17.25H18.75&#34; stroke=&#34;#FF671D&#34; stroke-width=&#34;1.5&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
&lt;/svg&gt;
&lt;/div&gt;
    &lt;span&gt;Docs &amp;amp; blog posts&lt;/span&gt;
  &lt;/div&gt;
  
&lt;/div&gt;








  


&lt;div class=&#34;orange-outline-list br-12 border-color-orange-flat border-width-2 p-1-5 pb-1&#34; x3-data=&#34;selectStack(&#39;/docs/learning-paths/deploy-alert-terraform&#39;)&#34;&gt;
  &lt;div class=&#34;icon-heading d-flex&#34;&gt;
    &lt;div class=&#34;icon-heading__container&#34;&gt;
  &lt;svg width=&#34;30&#34; height=&#34;30&#34; viewBox=&#34;0 0 25 26&#34; fill=&#34;none&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
  &lt;path d=&#34;M16.1401 14.4402C16.2141 14.4402 16.2852 14.4101 16.3373 14.3581C16.5355 14.1569 21.1904 9.39886 21.1904 5.0513C21.1904 2.26537 18.924 0 16.1391 0C13.3541 0 11.0878 2.26537 11.0878 5.0513C11.0878 9.39886 15.7427 14.1569 15.9419 14.3581C15.9939 14.4111 16.065 14.4402 16.1401 14.4402ZM13.5814 5.0513C13.5814 3.63882 14.7266 2.49262 16.1401 2.49262C17.5536 2.49262 18.6978 3.63781 18.6978 5.0513C18.6978 6.46478 17.5526 7.60999 16.1401 7.60999C14.7276 7.60999 13.5814 6.46478 13.5814 5.0513Z&#34; fill=&#34;#FF671D&#34;/&gt;
  &lt;path d=&#34;M24.9034 21.9305C24.0595 18.9113 17.9561 17.4147 12.5704 16.0933C9.54023 15.3496 5.76827 14.4246 5.73524 13.6037C5.72823 13.4225 5.97949 12.7398 9.52922 11.5516C9.80551 11.4585 9.96668 11.1842 9.91262 10.8989C9.85856 10.6136 9.60229 10.4164 9.318 10.4304C4.13956 10.6807 0.501743 12.1602 0.0482666 14.1993C-0.172966 15.1944 0.26149 16.749 3.58398 18.5009L4.29773 18.8763C6.54509 20.0545 8.16879 20.9064 8.1808 21.6992C8.19482 22.6502 5.93745 24.0507 3.72713 25.296C3.58398 25.3761 3.5139 25.5433 3.55495 25.7024C3.59699 25.8616 3.74014 25.9717 3.90431 25.9717H23.0354C23.1315 25.9717 23.2226 25.9337 23.2907 25.8656C24.6971 24.4581 25.2397 23.1347 24.9034 21.9305Z&#34; fill=&#34;#FBC55A&#34;/&gt;
&lt;/svg&gt;
&lt;/div&gt;
    &lt;div class=&#34;no-anchor-heading&#34;&gt;
      &lt;h4&gt;Open in Grafana Cloud&lt;/h4&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&#34;mt-1&#34;&gt;
    &lt;p class=&#34;mb-1 maxw-650&#34;&gt;
      
        Complete this learning path directly in your Grafana Cloud stack, or in the Grafana Play stack, with an interactive learning experience.
      
    &lt;/p&gt;
    &lt;div class=&#34;d-flex column-gap-1 justify-content-end&#34;&gt;
      &lt;a
        x3-bind:href=&#34;launchUrl&#34;
        class=&#34;btn btn--primary br-8&#34;
        target=&#34;_blank&#34;
        x3-on:click=&#34;trackPathfinderClick(&#39;deploy-alert-terraform&#39;, &#39;Deploy an alert rule with Terraform&#39;)&#34;&gt;
        Open in Grafana Cloud
      &lt;/a&gt;
      
      &lt;a
        x3-bind:href=&#34;playUrl&#34;
        class=&#34;btn btn--primary br-8&#34;
        target=&#34;_blank&#34;
        x3-on:click=&#34;trackPlayClick(&#39;deploy-alert-terraform&#39;, &#39;Deploy an alert rule with Terraform&#39;)&#34;&gt;
        Try in Grafana Play
      &lt;/a&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;div class=&#34;mt-1&#34;&gt;
  &lt;a
    href=&#34;/docs/learning-paths/deploy-alert-terraform/&#34;
    target=&#34;_blank&#34;
    rel=&#34;noopener noreferrer&#34;
    class=&#34;btn btn--outline arrow w-100p br-8&#34;
    x3-on:click=&#34;$dispatch(&#39;track-view-on-website&#39;, {
      pathId: &#39;deploy-alert-terraform&#39;,
      pathTitle: &#39;Deploy an alert rule with Terraform&#39;
    })&#34;&gt;
    View on website
  &lt;/a&gt;
&lt;/div&gt;

&lt;/div&gt;



]]></content><description>&lt;h2 id="learning-path-deploy-an-alert-rule-with-terraform">Learning path: Deploy an alert rule with Terraform&lt;/h2>
&lt;p>The following table describes the steps you&amp;rsquo;ll work through in the learning path.&lt;/p>
&lt;section class="expand-table-wrapper">&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Step&lt;/th>
&lt;th>What you&amp;rsquo;ll do&lt;/th>
&lt;th>Outcome&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;strong>1. Why Terraform?&lt;/strong>&lt;/td>
&lt;td>Understand why Terraform is a natural fit for deploying alerting resources&lt;/td>
&lt;td>Context for choosing Terraform over manual workflows&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>2. Create a service account&lt;/strong>&lt;/td>
&lt;td>Set up API credentials in Grafana for Terraform&lt;/td>
&lt;td>A service account token for authentication&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>3. Configure the provider&lt;/strong>&lt;/td>
&lt;td>Declare the Grafana Terraform provider and authenticate&lt;/td>
&lt;td>Terraform connected to your Grafana instance&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>4. Define a folder and an alert rule group&lt;/strong>&lt;/td>
&lt;td>Create a folder to organize your alert rules, anda &lt;code>grafana_rule_group&lt;/code> with a CPU usage alert&lt;/td>
&lt;td>An organizational folder and alert rule ready to deploy in Grafana&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>5. Add a contact point&lt;/strong>&lt;/td>
&lt;td>Define a &lt;code>grafana_contact_point&lt;/code> for Slack or email&lt;/td>
&lt;td>A notification destination configured&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>6. Add a notification policy&lt;/strong>&lt;/td>
&lt;td>Route alerts to the contact point based on labels&lt;/td>
&lt;td>A complete alerting pipeline&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>7. Run terraform plan&lt;/strong>&lt;/td>
&lt;td>Preview what Terraform will create in Grafana&lt;/td>
&lt;td>Confidence in what will change before applying&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>8. Apply and verify&lt;/strong>&lt;/td>
&lt;td>Run &lt;code>terraform apply&lt;/code> and confirm the resources appear in Grafana&lt;/td>
&lt;td>A live alerting pipeline deployed from code&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h2 id="before-you-start">Before you start&lt;/h2>
&lt;p>Have these ready before you open the path:&lt;/p></description></item></channel></rss>