Opsgenie create alert

From wikieduonline
(Redirected from Opsgenie.)
Jump to navigation Jump to search

Install the Opsgenie Provider in Terraform[edit]

terraform {
  required_providers {
    opsgenie = {
      source = "opsgenie/opsgenie"
      version = "0.5.0"  # or the latest version
    }
  }
} 

provider "opsgenie" {
  api_key = var.opsgenie_api_key  # Replace with your API key or use a secret variable
}


Create alert[edit]

resource "opsgenie_alert" "terraform_alert" {
  message     = "Terraform Alert: Plan Execution Failure"
  alias       = "terraform-plan-failure"
  description = "Terraform plan execution failed for the dev environment."
  teams       = [opsgenie_team.example_team.name]  # Specify your team
  priority    = "P1"
  tags = [
    "terraform",
    "failure"
  ]

  details = {
    region   = "us-east-1"
    severity = "high"
  }
}


Activities[edit]

Related[edit]

See also[edit]

Advertising: