Skip to content

Commit

Permalink
docs and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
swbradshaw committed Sep 29, 2023
1 parent 1f0ba92 commit 2d3dc6f
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -295,17 +295,17 @@ func testAccCheckPagerDutyEventOrchestrationPathGlobalAutomationActionsConfig(t,
return fmt.Sprintf("%s%s", createBaseGlobalOrchConfig(t, ep, s, o),
`resource "pagerduty_event_orchestration_global" "my_global_orch" {
event_orchestration = pagerduty_event_orchestration.orch.id
set {
id = "start"
rule {
label = "rule 1"
actions {
actions {
automation_action {
name = "test"
url = "https://test.com"
auto_send = true
header {
key = "foo"
value = "bar"
Expand All @@ -314,7 +314,7 @@ func testAccCheckPagerDutyEventOrchestrationPathGlobalAutomationActionsConfig(t,
key = "baz"
value = "buz"
}
parameter {
key = "source"
value = "orch"
Expand Down Expand Up @@ -363,16 +363,16 @@ func testAccCheckPagerDutyEventOrchestrationPathGlobalAutomationActionsParamsUpd
return fmt.Sprintf("%s%s", createBaseGlobalOrchConfig(t, ep, s, o),
`resource "pagerduty_event_orchestration_global" "my_global_orch" {
event_orchestration = pagerduty_event_orchestration.orch.id
set {
id = "start"
rule {
label = "rule 1"
actions {
actions {
automation_action {
name = "test1"
url = "https://test1.com"
header {
key = "foo1"
value = "bar1"
Expand Down Expand Up @@ -412,12 +412,12 @@ func testAccCheckPagerDutyEventOrchestrationPathGlobalAutomationActionsParamsDel
return fmt.Sprintf("%s%s", createBaseGlobalOrchConfig(t, ep, s, o),
`resource "pagerduty_event_orchestration_global" "my_global_orch" {
event_orchestration = pagerduty_event_orchestration.orch.id
set {
id = "start"
rule {
label = "rule 1"
actions {
actions {
automation_action {
name = "test"
url = "https://test.com"
Expand All @@ -444,7 +444,7 @@ func testAccCheckPagerDutyEventOrchestrationPathGlobalInvalidExtractionsConfig(t
createBaseGlobalOrchConfig(t, ep, s, o),
fmt.Sprintf(`resource "pagerduty_event_orchestration_global" "my_global_orch" {
event_orchestration = pagerduty_event_orchestration.orch.id
set {
id = "start"
rule {
Expand All @@ -467,7 +467,7 @@ func testAccCheckPagerDutyEventOrchestrationPathGlobalAllActionsConfig(t, ep, s,
return fmt.Sprintf("%s%s", createBaseGlobalOrchConfig(t, ep, s, o),
`resource "pagerduty_event_orchestration_global" "my_global_orch" {
event_orchestration = pagerduty_event_orchestration.orch.id
set {
id = "start"
rule {
Expand Down Expand Up @@ -505,6 +505,10 @@ func testAccCheckPagerDutyEventOrchestrationPathGlobalAllActionsConfig(t, ep, s,
source = "event.group"
target = "event.custom_details.message"
}
incident_custom_field_update {
id = "PIJ90N7"
value = "foo"
}
}
}
rule {
Expand Down Expand Up @@ -574,7 +578,7 @@ func testAccCheckPagerDutyEventOrchestrationPathGlobalAllActionsUpdateConfig(t,
return fmt.Sprintf("%s%s", createBaseGlobalOrchConfig(t, ep, s, o),
`resource "pagerduty_event_orchestration_global" "my_global_orch" {
event_orchestration = pagerduty_event_orchestration.orch.id
set {
id = "start"
rule {
Expand Down Expand Up @@ -603,6 +607,10 @@ func testAccCheckPagerDutyEventOrchestrationPathGlobalAllActionsUpdateConfig(t,
target = "event.custom_details.message_upd"
template = "[UPD] High CPU usage on {{variables.hostname}}: {{variables.cpu_val}}"
}
incident_custom_field_update {
id = "PIJ90N7"
value = "bar"
}
}
}
rule {
Expand Down Expand Up @@ -666,7 +674,7 @@ func testAccCheckPagerDutyEventOrchestrationPathGlobalAllActionsUpdateConfig(t,
path = "event.custom_details.updated_at"
type = "regex"
value = "UPD (.*)"
}
}
extraction {
regex = ".*"
source = "event.custom_details.region_upd"
Expand All @@ -682,7 +690,7 @@ func testAccCheckPagerDutyEventOrchestrationPathGlobalAllActionsDeleteConfig(t,
return fmt.Sprintf("%s%s", createBaseGlobalOrchConfig(t, ep, s, o),
`resource "pagerduty_event_orchestration_global" "my_global_orch" {
event_orchestration = pagerduty_event_orchestration.orch.id
set {
id = "start"
rule {
Expand Down Expand Up @@ -719,7 +727,7 @@ func testAccCheckPagerDutyEventOrchestrationPathGlobalOneSetNoActionsConfig(t, e
return fmt.Sprintf("%s%s", createBaseGlobalOrchConfig(t, ep, s, o),
`resource "pagerduty_event_orchestration_global" "my_global_orch" {
event_orchestration = pagerduty_event_orchestration.orch.id
set {
id = "start"
rule {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ func testAccCheckPagerDutyEventOrchestrationPathServiceDefaultConfig(ep, s strin
return fmt.Sprintf("%s%s", createBaseServicePathConfig(ep, s),
`resource "pagerduty_event_orchestration_service" "serviceA" {
service = pagerduty_service.bar.id
set {
id = "start"
}
Expand All @@ -344,17 +344,17 @@ func testAccCheckPagerDutyEventOrchestrationPathServiceAutomationActionsConfig(e
return fmt.Sprintf("%s%s", createBaseServicePathConfig(ep, s),
`resource "pagerduty_event_orchestration_service" "serviceA" {
service = pagerduty_service.bar.id
set {
id = "start"
rule {
label = "rule 1"
actions {
actions {
automation_action {
name = "test"
url = "https://test.com"
auto_send = true
header {
key = "foo"
value = "bar"
Expand All @@ -363,7 +363,7 @@ func testAccCheckPagerDutyEventOrchestrationPathServiceAutomationActionsConfig(e
key = "baz"
value = "buz"
}
parameter {
key = "source"
value = "orch"
Expand Down Expand Up @@ -412,16 +412,16 @@ func testAccCheckPagerDutyEventOrchestrationPathServiceAutomationActionsParamsUp
return fmt.Sprintf("%s%s", createBaseServicePathConfig(ep, s),
`resource "pagerduty_event_orchestration_service" "serviceA" {
service = pagerduty_service.bar.id
set {
id = "start"
rule {
label = "rule 1"
actions {
actions {
automation_action {
name = "test1"
url = "https://test1.com"
header {
key = "foo1"
value = "bar1"
Expand Down Expand Up @@ -461,12 +461,12 @@ func testAccCheckPagerDutyEventOrchestrationPathServiceAutomationActionsParamsDe
return fmt.Sprintf("%s%s", createBaseServicePathConfig(ep, s),
`resource "pagerduty_event_orchestration_service" "serviceA" {
service = pagerduty_service.bar.id
set {
id = "start"
rule {
label = "rule 1"
actions {
actions {
automation_action {
name = "test"
url = "https://test.com"
Expand All @@ -493,7 +493,7 @@ func testAccCheckPagerDutyEventOrchestrationPathServiceInvalidExtractionsConfig(
createBaseServicePathConfig(ep, s),
fmt.Sprintf(`resource "pagerduty_event_orchestration_service" "serviceA" {
service = pagerduty_service.bar.id
set {
id = "start"
rule {
Expand All @@ -516,7 +516,7 @@ func testAccCheckPagerDutyEventOrchestrationPathServiceAllActionsConfig(ep, s st
return fmt.Sprintf("%s%s", createBaseServicePathConfig(ep, s),
`resource "pagerduty_event_orchestration_service" "serviceA" {
service = pagerduty_service.bar.id
set {
id = "start"
rule {
Expand Down Expand Up @@ -557,6 +557,10 @@ func testAccCheckPagerDutyEventOrchestrationPathServiceAllActionsConfig(ep, s st
source = "event.group"
target = "event.custom_details.message"
}
incident_custom_field_update {
id = "PIJ90N7"
value = "foo"
}
}
}
}
Expand Down Expand Up @@ -620,7 +624,7 @@ func testAccCheckPagerDutyEventOrchestrationPathServiceAllActionsUpdateConfig(ep
return fmt.Sprintf("%s%s", createBaseServicePathConfig(ep, s),
`resource "pagerduty_event_orchestration_service" "serviceA" {
service = pagerduty_service.bar.id
set {
id = "start"
rule {
Expand Down Expand Up @@ -652,6 +656,10 @@ func testAccCheckPagerDutyEventOrchestrationPathServiceAllActionsUpdateConfig(ep
target = "event.custom_details.message_upd"
template = "[UPD] High CPU usage on {{variables.hostname}}: {{variables.cpu_val}}"
}
incident_custom_field_update {
id = "PIJ90N7"
value = "bar"
}
}
}
}
Expand Down Expand Up @@ -709,7 +717,7 @@ func testAccCheckPagerDutyEventOrchestrationPathServiceAllActionsUpdateConfig(ep
path = "event.custom_details.updated_at"
type = "regex"
value = "UPD (.*)"
}
}
extraction {
regex = ".*"
source = "event.custom_details.region_upd"
Expand All @@ -725,7 +733,7 @@ func testAccCheckPagerDutyEventOrchestrationPathServiceAllActionsDeleteConfig(ep
return fmt.Sprintf("%s%s", createBaseServicePathConfig(ep, s),
`resource "pagerduty_event_orchestration_service" "serviceA" {
service = pagerduty_service.bar.id
set {
id = "start"
rule {
Expand Down Expand Up @@ -758,7 +766,7 @@ func testAccCheckPagerDutyEventOrchestrationPathServiceOneSetNoActionsConfig(ep,
return fmt.Sprintf("%s%s", createBaseServicePathConfig(ep, s),
`resource "pagerduty_event_orchestration_service" "serviceA" {
service = pagerduty_service.bar.id
set {
id = "start"
rule {
Expand All @@ -783,7 +791,7 @@ func testAccCheckPagerDutyEventOrchestrationPathServiceEnableEOForServiceEnableU
`resource "pagerduty_event_orchestration_service" "serviceA" {
service = pagerduty_service.bar.id
enable_event_orchestration_for_service = true
set {
id = "start"
}
Expand All @@ -800,7 +808,7 @@ func testAccCheckPagerDutyEventOrchestrationPathServiceEnableEOForServiceDisable
`resource "pagerduty_event_orchestration_service" "serviceA" {
service = pagerduty_service.bar.id
enable_event_orchestration_for_service = false
set {
id = "start"
}
Expand Down
3 changes: 3 additions & 0 deletions website/docs/r/event_orchestration_global.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ The following arguments are supported:
* `suspend` - (Optional) The number of seconds to suspend the resulting alert before triggering. This effectively pauses incident notifications. If a `resolve` event arrives before the alert triggers then PagerDuty won't create an incident for this alert.
* `priority` - (Optional) The ID of the priority you want to set on resulting incident. Consider using the [`pagerduty_priority`](https://registry.terraform.io/providers/PagerDuty/pagerduty/latest/docs/data-sources/priority) data source.
* `annotate` - (Optional) Add this text as a note on the resulting incident.
* `incident_custom_field_update` - (Optional) Assign a custom field to the resulting incident.
* `id` - (Required) The custom field id
* `value` - (Required) The value to assign this custom field
* `automation_action` - (Optional) Create a [Webhook](https://support.pagerduty.com/docs/event-orchestration#webhooks) associated with the resulting incident.
* `name` - (Required) Name of this Webhook.
* `url` - (Required) The API endpoint where PagerDuty's servers will send the webhook request.
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/event_orchestration_service.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ The following arguments are supported:
* `priority` - (Optional) The ID of the priority you want to set on resulting incident. Consider using the [`pagerduty_priority`](https://registry.terraform.io/providers/PagerDuty/pagerduty/latest/docs/data-sources/priority) data source.
* `annotate` - (Optional) Add this text as a note on the resulting incident.
* `incident_custom_field_update` - (Optional) Assign a custom field to the resulting incident.
* `id` - (Required) The custom field id
* `value` - (Required) The value to assign this custom field
* `pagerduty_automation_action` - (Optional) Configure a [Process Automation](https://support.pagerduty.com/docs/event-orchestration#process-automation) associated with the resulting incident.
* `action_id` - (Required) Id of the Process Automation action to be triggered.
* `automation_action` - (Optional) Create a [Webhook](https://support.pagerduty.com/docs/event-orchestration#webhooks) associated with the resulting incident.
Expand Down

0 comments on commit 2d3dc6f

Please sign in to comment.