Path

Learn how to apply your confirmed plan and deploy your alerting pipeline to Grafana.

Estimated time: 2 min

Apply and verify

With the plan confirmed, you can now apply it to deploy your alerting pipeline to Grafana.

To deploy and verify your alerting pipeline, complete the following steps:

  1. Run terraform apply:

    Bash
    terraform apply
  2. Terraform displays the plan again and asks for confirmation. Type yes and press Enter:

    Do you want to perform these actions?
      Terraform will perform the actions described above.
      Only 'yes' will be accepted to approve.
    
      Enter a value: yes
  3. Wait for Terraform to complete. You should see:

    Apply complete! Resources: 4 added, 0 changed, 0 destroyed.
  4. Open your Grafana instance in a browser and navigate to Alerting > Alert rules in the left-side menu.

  5. Look for the Terraform Alerts folder. Click into it.

  6. Confirm the CPU alerts rule group appears with the High CPU usage rule.

  7. Navigate to Alerting > Contact points and confirm Email alerts appears.

  8. Navigate to Alerting > Notification policies and confirm the default route points to your contact point.

Updating a deployed alert rule

When you modify your HCL and run terraform apply again, Terraform detects the change and updates the existing resources in place. No duplicates, no manual intervention.

Bash
# After modifying alerts.tf:
terraform plan    # Preview the update
terraform apply   # Apply the update

What Terraform state tracks

Terraform stores the deployed resource IDs in its state file (terraform.tfstate). This is how it knows whether to create or update a resource on subsequent runs. Keep the state file safe. If you lose it, Terraform won’t know about existing resources.

Your alerting pipeline is now deployed and managed by Terraform.