opsgenie / terraform-provider-opsgenie

Terraform OpsGenie provider
https://registry.terraform.io/providers/opsgenie/opsgenie/latest/docs
Mozilla Public License 2.0
103 stars 137 forks source link

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

Open MarcosRava opened 1 year ago

MarcosRava commented 1 year ago

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

marcossv9 commented 1 month ago

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.