Difference between revisions of "Import opsgenie"
Jump to navigation
Jump to search
Line 19: | Line 19: | ||
+ | |||
+ | === Create alert === | ||
+ | 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" | ||
+ | } | ||
+ | } | ||
== Related == | == Related == |
Revision as of 09:51, 1 October 2024
opsgenie.create_alert opsgenie.send_recovery
Install the Opsgenie Provider in Terraform
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
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" } }
Related
See also
Advertising: