terraform-provider-opsgenie
terraform-provider-opsgenie copied to clipboard
Conditions ordering does not work in opsgenie_alert_policy
It looks like the ordering on alert policy conditions isn't working correctly and seems to want to constantly swap them around on each run
Terraform Version
$ terraform --version Terraform v0.12.26 provider.opsgenie v0.5.1
Affected Resource(s)
opsgenie_alert_policy
Terraform Configuration Files
resource "opsgenie_alert_policy" "alert_test" {
name = "Example Alert Policy"
team_id = data.opsgenie_team.team1.id
policy_description = "This does some stuff with alerts"
message = "{{message}}"
continue_policy = true
filter {
type = "match-all-conditions"
conditions {
field = "priority"
operation = "equals"
expected_value = "P2"
order = 0
}
conditions {
field = "extra-properties"
operation = "equals"
key = "user"
expected_value = "value"
order = 1
}
}
responders {
type = "team"
id = data.opsgenie_team.team2.id
}
}
Expected Behavior
It should maintain the order and subsequent runs should show no changes
Actual Behavior
It flips the ordering of the two conditions every time it runs
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
terraform apply
We've also encountered this issue.
Our solution is to call the OpsGenie REST API and modify the resources in our terraform plans to match the orders in which they are returned.
We're also experiencing this on resource opsgenie_integration_action. When I have 10 conditions terraform plan always wants to reorder, regardless of how they are sorted in the plan file (order 10 at the bottom or second).
We're also experiencing the same issue on opsgenie_team:
Terraform will perform the following actions:
# opsgenie_team.team-name will be updated in-place
~ resource "opsgenie_team" "team-name" {
id = "34910294-db8f-4d0b-8c76-6b63819dko92"
name = "Team_Name"
# (1 unchanged attribute hidden)
~ member {
~ id = "acbd3636-b10a-4771-b736-kd9sa7f82k10" -> "7505f06c-8936-4e63-82b2-k39fas0f71k2"
# (1 unchanged attribute hidden)
}
~ member {
~ id = "7505f06c-8936-4e63-82b2-k39fas0f71k2" -> "acbd3636-b10a-4771-b736-kd9sa7f82k10"
# (1 unchanged attribute hidden)
}
}
If you'll notice, Terraform just wants to change the ordering around, but Terraform shouldn't really care about that... or the ordering should be consistent.
This should be fixed in the latest release v0.6.30. Closing this issue :)