Skip to content
This repository has been archived by the owner on May 16, 2020. It is now read-only.

andrecloutier/terraform-provider-datadogpagerduty

Repository files navigation

⚠️ This provider should no longer be used now that the datadog_integration_pagerduty_service_object resource resource is available in the official Datadog provider. No further updates will be made to this provider.

Terraform Provider

Custom provider which allows per service configuration of the DataDog PagerDuty integration.

This is a stop gap till something like this gets merged into the main client.

Sample Usage

provider "pagerduty" {
  token = "aaaaaa"
}

provider "datadog" {
  api_key = "bbbbbb"
  app_key = "cccccc"
}

provider "datadogpagerduty" {
  api_key = "bbbbbb"
  app_key = "cccccc"
}

data "pagerduty_vendor" "datadog" {
  name = "Datadog"
}

resource "pagerduty_service" "alert_query_service" {
  name                    = "Another Alert Query Service"
  auto_resolve_timeout    = 14400
  acknowledgement_timeout = 600
  escalation_policy       = "P2EUG11"
  alert_creation          = "create_alerts_and_incidents"
}

resource "pagerduty_service_integration" "alert_query_service_datadog" {
  name    = "${data.pagerduty_vendor.datadog.name}"
  service = "${pagerduty_service.alert_query_service.id}"
  vendor  = "${data.pagerduty_vendor.datadog.id}"
}

resource "datadogpagerduty_service_integration" "pd_aqs" {
  service_name = "AnotherAlertQueryServices"
  service_key  = "${pagerduty_service_integration.alert_query_service_datadog.integration_key}"
}

resource "datadog_monitor" "foo" {
  name                = "Monitor for AnotherAQS"
  type                = "metric alert"
  message             = "Monitor triggered.  Notify: ${datadog_pagerduty_service_integration.pd_aqs.notify_handle}"
  query               = "avg(last_1h):avg:aws.ec2.cpuutilization{*} > 50"
  notify_no_data      = false
  require_full_window = false
  tags                = ["terraform:true"]
}