Using `scheduled_actions` with "use_support_hours" and "severity_based" gives a strange error message

I was trying to get the following Terraform to work:

 resource "pagerduty_service" "example" {
  name = "Example Service"
  escalation_policy = pagerduty_escalation_policy.example.id

  incident_urgency_rule {
    type = "use_support_hours"

    during_support_hours {
      type = "constant"
      urgency = "high"
    }

    outside_support_hours {
      type = "constant"
      urgency = "severity_based"
    }
  }

  support_hours {
    type = "fixed_time_per_day"
    time_zone = "America/Los_Angeles"
    days_of_week = [1,2,3,4,5]
    start_time = "09:00:00"
    end_time = "17:00:00"
  }

  scheduled_actions {
    type       = "urgency_change"
    to_urgency = "high"

    at {
      type = "named_time"
      name = "support_hours_start"
    }
  }
}

But I got a strange error message when running terraform apply:

Error: PUT API call to https://api.pagerduty.com/services/P2A8DVT failed 400 Bad Request. Code: 2001, Errors: [Scheduled actions can only include upurgency at service hours start if urgency is high during service hours.], Message: Invalid Input Provided

on example.tf line 56, in resource “pagerduty_service” “example”:
56: resource “pagerduty_service” “example” {

I think this is strange because urgency is configured to be high during service hours.

If I configure the incident_rule, like this I don’t get that error when I run terraform apply:

  incident_urgency_rule {
    type = "use_support_hours"

    during_support_hours {
      type = "constant"
      urgency = "severity_based"
    }

    outside_support_hours {
      type = "constant"
      urgency = "low"
    }
  }

I believe the error is thrown because we only currently do not allow to have scheduled actions with dynamic notification option selected for during or outside support hours. You can confirm the same if you navigate to a service page > Settings > Assign and notify in PagerDuty UI. I definitely agree that Scheduled actions can only include upurgency at service hours start if urgency is high during service hours error is indeed misleading. We’ll notify the relevant teams to get it addressed, so thank you for flagging!

It makes sense that it isn’t supported, because the UI doesn’t allow scheduled actions. Yep, as you said, the error should be improved. And also, I don’t understand why the second incident_urgency_rule snippet went through without an error. Perhaps they missed this variation?

Are you referring to the below snipped you shared?

incident_urgency_rule {
type = "use_support_hours"

during_support_hours {
type = "constant"
urgency = "severity_based"
}

outside_support_hours {
type = "constant"
urgency = "low"
}
}

If yes, I just tested it as is (without the support hours block) and it did throw a 400 Support hours is required. error as expected. Unless you meant the lack of scheduled_actions definition? While our documentation currently states it is required, I do not believe this is actually the case, and we are working on getting this corrected after the Summit.