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

Enum in opsgenie_service_incident_rule field is incorrect `recipients` ~ `responders`

Open MarcosRava opened this issue 2 years ago • 1 comments

Terraform Version

v1.3.6

Affected Resource(s)

opsgenie_service_incident_rule

Terraform Configuration Files

resource "opsgenie_service_incident_rule" "errors" {
  service_id = opsgenie_service.this.id
  incident_rule {
    condition_match_type = "match-any-condition"
    conditions {
      field          = "message"
      operation      = "contains"
      expected_value = "Error"
    }
    conditions {
      field          = "recipients"
      operation      = "contains"
      expected_value = local.opsgenie_team.name
    }
    incident_properties {
      message  = "{{message}}"
      priority = "P2"
      stakeholder_properties {
        message = "{{message}}"
      }
    }
  }
}

Debug Output

When I run apply

 Error: Error occurred with Status code: 422, Message:  ServiceName: accountService Response: { Status: 422 Body: [ {"message":"Property [field] should be one of [alias,description,extraProperties,source,message,priority,actions,responders,entity,tags]","took":0.053,"requestId":"c5aa1988-4736-4a59-8a9f-8560cd756a75"} ] } Request: { URI: http://og-apps-account-service.mesh:20012/incidentRollupRules?customerId=44910ec0-8746-4a8e-80f9-ad9c21627850&serviceId=4106d369-c6bf-440d-9a46-6d688b7da080&teamId=5a8e3224-a495-46e7-b7d1-4b11d82221d6 Body: [ {"customerId":"44910ec0-8746-4a8e-80f9-ad9c21627850","serviceId":"4106d369-c6bf-440d-9a46-6d688b7da080","teamId":"5a8e3224-a495-46e7-b7d1-4b11d82221d6","order":1.0,"filter":{"type":"match-any-condition","conditions":[{"field":"recipients","expectedValue":"DriversJourney","not":false,"operation":"contains"},{"field":"message","expectedValue":"dbs-retries-per-driver","not":false,"operation":"contains"}]},"message":"{{message}}","description":"{{description}}","priority":"P2","enableStakeholder":true,"stakeholderMessage":"{{message}}","stakeholderDescription":""} ] }, Took: 0.098000, RequestId: b18d044e-c031-436b-ad3a-69c8c41a58b2

If I change the field value to responders, I receive the following error:

expected incident_rule.0.conditions.0.field to be one of [message description tags extra-properties recipients teams priority alias source entity actions details], got responders

Expected Behavior

Should apply responders to rule

Actual Behavior

Error in field enum value recipients

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

Important Factoids

Running in github actions

MarcosRava avatar Feb 08 '23 20:02 MarcosRava

Hi, thanks for reporting the issue. I'm also facing the same issues you have reported.

No way to use either respondents or recipients in an incident_rule condition. It kind of feels like the terraform provider for opsgenie is very incomplete, making us configure half of the things from the UI and not entirely with Terraform.

marcossv9 avatar Sep 16 '24 21:09 marcossv9

I have created a support ticket with Opsgenie Support Team, will update this issue as soon as I get a proper answer.

marcossv9 avatar Nov 11 '24 20:11 marcossv9

So got an update from opsgenie support team today, and they have pointed me to this bug ticket, but there is no ETA about when it will be fixed. The workaround suggested is: "Add the filters in the UI after creating the rule via API."

marcossv9 avatar Nov 12 '24 18:11 marcossv9