pagerduty_event_orchestration_global_cache_variable

A Cache Variable can be created on a Global Event Orchestration, in order to temporarily store event data to be referenced later within the Global Event Orchestration

Example of configuring a Cache Variable for a Global Event Orchestration

This example shows creating a global Event Orchestration and a Cache Variable. All events that have the event.source field will have its source value stored in this Cache Variable, and appended as a note for the subsequent incident created by this Event Orchestration.

resource "pagerduty_team" "database_team" {
  name = "Database Team"
}

resource "pagerduty_event_orchestration" "event_orchestration" {
  name = "Example Orchestration"
  team = pagerduty_team.database_team.id
}

resource "pagerduty_event_orchestration_global_cache_variable" "cache_var" {
  event_orchestration = pagerduty_event_orchestration.event_orchestration.id
  name = "recent_host"

  condition {
    expression = "event.source exists"
  }

  configuration {
    type = "recent_value"
    source = "event.source"
    regex = ".*"
  }
}

resource "pagerduty_event_orchestration_global" "global" {
  event_orchestration = pagerduty_event_orchestration.event_orchestration.id
  set {
    id = "start"
    rule {
      label = "Always annotate the incident with the event source for all events"
      actions {
        annotate = "Last time, we saw this incident occur on host: {{cache_var.recent_host}}"
      }
    }
  }

  catch_all {
    actions { }
  }
}

Argument Reference

The following arguments are supported:

Attributes Reference

The following attributes are exported:

Import

Cache Variables can be imported using colon-separated IDs, which is the combination of the Global Event Orchestration ID followed by the Cache Variable ID, e.g.

$ terraform import pagerduty_event_orchestration_global_cache_variable.cache_variable 5e7110bf-0ee7-429e-9724-34ed1fe15ac3:138ed254-3444-44ad-8cc7-701d69def439