terraform-provider-pagerduty icon indicating copy to clipboard operation
terraform-provider-pagerduty copied to clipboard

pagerduty_incident_workflow_trigger condition incorrectly reguired when type is conditional

Open PitcherIT opened this issue 6 months ago • 0 comments

Terraform Version

Terraform v1.7.4 PagerDuty provider 3.15.2

Affected Resource(s)

pagerduty_incident_workflow_trigger

Terraform Configuration Files

resource "pagerduty_incident_workflow" "test_workflow" {
  name         = "Test Condition Triggered Incident"
  description  = "This Incident Workflow is an example"
  step {
    name           = "Send Status Update"
    action         = "pagerduty.com:incident-workflows:send-status-update:1"
    input {
      name = "Message"
      value = "Example status message sent on {{current_date}}"
    }
  }
}

resource "pagerduty_incident_workflow_trigger" "automatic_trigger" {
  type                       = "conditional"
  workflow                   = pagerduty_incident_workflow.test_workflow.id
  condition                  = null
  subscribed_to_all_services = true
}

Expected Behavior

Trigger is created and shows as "When incident is created" in the PagerDuty UI

Actual Behavior

Trigger cannot be created as condition is incorrectly required if type = "conditional"

Error: when trigger type conditional is used, condition must be specified

Steps to Reproduce

  1. terraform plan

Important Factoids

Conditional trigger supports two options in the UI:

  • When incident is created
  • When conditions are met When setting "When incident is created", that trigger from in the API returns condition as "" (null), and on a Terrafrom import shows it as null.
# __generated__ by Terraform
resource "pagerduty_incident_workflow_trigger" "testtrigger" {
  condition                  = null
  services                   = ["PX49EAW"]
  subscribed_to_all_services = false
  type                       = "conditional"
  workflow                   = "PA9Z9U3"
  permissions {
    restricted = false
    team_id    = null
  }
}

PitcherIT avatar Aug 14 '24 11:08 PitcherIT