Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orca 4805 - adds escalation policy support in rule actions #901

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ func buildEventOrchestrationPathGlobalRuleActionsSchema() map[string]*schema.Sch
Optional: true,
}

a["escalation_policy"] = &schema.Schema{
Type: schema.TypeString,
Optional: true,
}

return a
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ func TestAccPagerDutyEventOrchestrationPathGlobal_Basic(t *testing.T) {
Config: testAccCheckPagerDutyEventOrchestrationGlobalDefaultConfig(team, escalationPolicy, service, orch),
Check: resource.ComposeTestCheckFunc(baseChecks...),
},
{
Config: testAccCheckPagerDutyEventOrchestrationGlobalDefaultWithEscalationPolicy(team, escalationPolicy, service, orch),
Check: resource.ComposeTestCheckFunc(baseChecks...),
},

// Adding/updating/deleting automation_action properties
{
Config: testAccCheckPagerDutyEventOrchestrationPathGlobalAutomationActionsConfig(team, escalationPolicy, service, orch),
Expand Down Expand Up @@ -291,6 +296,27 @@ func testAccCheckPagerDutyEventOrchestrationGlobalDefaultConfig(t, ep, s, o stri
`)
}

func testAccCheckPagerDutyEventOrchestrationGlobalDefaultWithEscalationPolicy(t, ep, s, o string) string {
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

catch_all {
actions {}
}
set {
id = "start"
rule {
label = "rule 1"
actions {
"escalation_policy": "POLICY"
}
}
}
}
`)
}

func testAccCheckPagerDutyEventOrchestrationPathGlobalAutomationActionsConfig(t, ep, s, o string) string {
return fmt.Sprintf("%s%s", createBaseGlobalOrchConfig(t, ep, s, o),
`resource "pagerduty_event_orchestration_global" "my_global_orch" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ func buildEventOrchestrationPathServiceRuleActionsSchema() map[string]*schema.Sc
Optional: true,
}

a["escalation_policy"] = &schema.Schema{
Type: schema.TypeString,
Optional: true,
}

return a
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ func TestAccPagerDutyEventOrchestrationPathService_Basic(t *testing.T) {
Config: testAccCheckPagerDutyEventOrchestrationPathServiceDefaultConfig(escalationPolicy, service),
Check: resource.ComposeTestCheckFunc(baseChecks...),
},
{
Config: testAccCheckPagerDutyEventOrchestrationServiceEscalationPolicy(escalationPolicy, service),
Check: resource.ComposeTestCheckFunc(baseChecks...),
},
// Adding/updating/deleting automation_action properties
{
Config: testAccCheckPagerDutyEventOrchestrationPathServiceAutomationActionsConfig(escalationPolicy, service),
Expand Down Expand Up @@ -341,6 +345,31 @@ func createBaseServicePathConfig(ep, s string) string {
`, ep, s)
}

func testAccCheckPagerDutyEventOrchestrationServiceEscalationPolicy(ep, s string) string {
return fmt.Sprintf("%s%s", createBaseServicePathConfig(ep, s),
`resource "pagerduty_event_orchestration_service" "serviceA" {
service = pagerduty_service.bar.id

set {
id = "start"
}

catch_all {
actions { }
}
set {
id = "start"
rule {
label = "rule 1"
actions {
"escalation_policy": "POLICY"
}
}
}
}
`)
}

func testAccCheckPagerDutyEventOrchestrationPathServiceDefaultConfig(ep, s string) string {
return fmt.Sprintf("%s%s", createBaseServicePathConfig(ep, s),
`resource "pagerduty_event_orchestration_service" "serviceA" {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading