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

`service_incident_rule` uses required string `service_id` #334

Open Benbentwo opened 2 years ago

Benbentwo commented 2 years ago

Terraform Version

v1.2.5

Affected Resource(s)

Terraform Configuration Files

resource "opsgenie_team" "test" {
  name        = "example-team"
  description = "This team deals with all the things, where incidents are >= P2"
}
resource "opsgenie_service_incident_rule" "test" {
  service_id = null # deal with all services, don't mark incident as immediately impacting a service
  incident_rule {
    condition_match_type = "match-all-condition"
    conditions {
        field = "priority"
        operation = "greater-than"
        expected_value = "P3"
    }
    incident_properties {
        message = "This is an incident message"
        priority = "P1"
        stakeholder_properties {
            message = "Message for stakeholders"
            enable = "true"
        }
    }
  }
}

Debug Output

N/A

Panic Output

N/A

Expected Behavior

Based on the web API ServiceId should be an array, allowing us to specify multiple services as affected by a rule. e.g. if DB goes down, both FE and BE are impacted. Similarly, an empty array means no services are immediately impacted, but we mark it as an incident for higher priority, post mortems etc.

Actual Behavior

A team incident ruleset cannot be created via API because service_id must be set, and is a string that is non-nullable.

Steps to Reproduce

N/A - API limitation

Important Factoids

N/A

References

Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example: