Closed mjimeneznet closed 11 months ago
+ 1 to this since right now it prevents us from managing escalation policies in Terraform.
+1 to this, it would be very helpful for our team
+1 would be super helpful for our team 🙏🙏🙏
+1
+1
+1
+1
+1
+1
I'd be happy to take this one on and provide a PR 🎉
Also have a need for enabling Round Robin in escalation policies from Terraform. This is blocking some adoption in my organization.
Here is my workaround using a Null Provider
# Activate Round Robin Scheduling for first layer in Escalation Policy
resource "null_resource" "pagerduty_round_robin_scheduling" {
count = var.service.roundrobin_scheduling == true ? 1 : 0
triggers = {
escalation_policy_id = pagerduty_escalation_policy.this.id,
}
provisioner "local-exec" {
command = <<EOT
set -e ; \
TARGET_ID=$(curl -s 'https://api.pagerduty.com/escalation_policies/${self.triggers.escalation_policy_id}?include[]=escalation_rule_assignment_strategies' \
--header "Authorization: Token token=$TF_VAR_pagerduty_token" \
--header 'Accept: application/vnd.pagerduty+json;version=2' \
--header 'Content-Type: application/json' \
--request GET | jq '. | .escalation_policy.escalation_rules[0].escalation_rule_assignment_strategy.type = "round_robin"') ; \
curl -s 'https://api.pagerduty.com/escalation_policies/${self.triggers.escalation_policy_id}?include[]=escalation_rule_assignment_strategies' \
--header "Authorization: Token token=$TF_VAR_pagerduty_token" \
--header 'Accept: application/vnd.pagerduty+json;version=2' \
--header 'Content-Type: application/json' \
--request PUT \
--data "$TARGET_ID"
EOT
}
provisioner "local-exec" {
when = destroy
command = <<-EOT
TARGET_ID=$(curl -s 'https://api.pagerduty.com/escalation_policies/${self.triggers.escalation_policy_id}?include[]=escalation_rule_assignment_strategies' \
--header "Authorization: Token token=$TF_VAR_pagerduty_token" \
--header 'Accept: application/vnd.pagerduty+json;version=2' \
--header 'Content-Type: application/json' \
--request GET | jq '. | .escalation_policy.escalation_rules[0].escalation_rule_assignment_strategy.type = "assign_to_everyone"') ; \
curl -s 'https://api.pagerduty.com/escalation_policies/${self.triggers.escalation_policy_id}?include[]=escalation_rule_assignment_strategies' \
--header "Authorization: Token token=$TF_VAR_pagerduty_token" \
--header 'Accept: application/vnd.pagerduty+json;version=2' \
--header 'Content-Type: application/json' \
--request PUT \
--data "$TARGET_ID"
EOT
}
depends_on = [pagerduty_escalation_policy.this]
}
Is there any progress on adding this to the provider? I've got teams wanting this feature.
Also have a need for enabling Round Robin in escalation policies from Terraform. This is blocking some adoption in my organization.
Here is my workaround using a Null Provider
# Activate Round Robin Scheduling for first layer in Escalation Policy resource "null_resource" "pagerduty_round_robin_scheduling" { count = var.service.roundrobin_scheduling == true ? 1 : 0 triggers = { escalation_policy_id = pagerduty_escalation_policy.this.id, } provisioner "local-exec" { command = <<EOT set -e ; \ TARGET_ID=$(curl -s 'https://api.pagerduty.com/escalation_policies/${self.triggers.escalation_policy_id}?include[]=escalation_rule_assignment_strategies' \ --header "Authorization: Token token=$TF_VAR_pagerduty_token" \ --header 'Accept: application/vnd.pagerduty+json;version=2' \ --header 'Content-Type: application/json' \ --request GET | jq '. | .escalation_policy.escalation_rules[0].escalation_rule_assignment_strategy.type = "round_robin"') ; \ curl -s 'https://api.pagerduty.com/escalation_policies/${self.triggers.escalation_policy_id}?include[]=escalation_rule_assignment_strategies' \ --header "Authorization: Token token=$TF_VAR_pagerduty_token" \ --header 'Accept: application/vnd.pagerduty+json;version=2' \ --header 'Content-Type: application/json' \ --request PUT \ --data "$TARGET_ID" EOT } provisioner "local-exec" { when = destroy command = <<-EOT TARGET_ID=$(curl -s 'https://api.pagerduty.com/escalation_policies/${self.triggers.escalation_policy_id}?include[]=escalation_rule_assignment_strategies' \ --header "Authorization: Token token=$TF_VAR_pagerduty_token" \ --header 'Accept: application/vnd.pagerduty+json;version=2' \ --header 'Content-Type: application/json' \ --request GET | jq '. | .escalation_policy.escalation_rules[0].escalation_rule_assignment_strategy.type = "assign_to_everyone"') ; \ curl -s 'https://api.pagerduty.com/escalation_policies/${self.triggers.escalation_policy_id}?include[]=escalation_rule_assignment_strategies' \ --header "Authorization: Token token=$TF_VAR_pagerduty_token" \ --header 'Accept: application/vnd.pagerduty+json;version=2' \ --header 'Content-Type: application/json' \ --request PUT \ --data "$TARGET_ID" EOT } depends_on = [pagerduty_escalation_policy.this] }
Building on the workaround from @BillSidney. Instead of only applying when the id
of the escalation policy changes I trigger it every time anything in the escalation policy changes. Like this:
triggers = {
escalation_policy_state = sha1(jsonencode({
resource_state = pagerduty_escalation_policy.this
}))
}
Hi @mjimeneznet support for Round Robin escalation rule assignment strategy for incident is now available from version v3.3.0. Thank you all for the patience and support 🎉 🥳
Terraform Version
Affected Resource(s)
Please list the resources as a list, for example:
Expected Behavior
I'm missing the option to set "round robin" as I can do in the UI for the escalation policy
Actual Behavior
We don't have the option to set "round robin" therefore if you create a escalation policy in Terraform you still have to go to UI to set the "round robin".