Skip to content

opsgenie_service_incident_rule conditions order is not stable causing "in-place" updates though nothing changes #332

Closed
@plaes

Description

I have following resources:

resource "opsgenie_service_incident_rule" "pingdom" {
  for_each   = toset(["service1", "service2", "service3"]
  service_id = resource.opsgenie_service.service[each.value].id

  incident_rule {
    condition_match_type = "match-all-conditions"
    conditions {
      field          = "source"
      not            = false
      operation      = "equals"
      expected_value = "Pingdom"
    }
    conditions {
      field          = "description"
      not            = false
      operation      = "matches"
      expected_value = ".*Check Name : ${var.site}/${each.value}:.*"
    }
    conditions {
      field          = "tags"
      not            = true
      operation      = "contains"
      expected_value = "no-incident"
    }
    ...

After running apply and then apply/plan again, some of the conditions have changed order, which is causing in-place updates (though nothing has changed):

  ~ resource "opsgenie_service_incident_rule" "pingdom" {
        id         = "..."
        # (1 unchanged attribute hidden)

      ~ incident_rule {
            # (1 unchanged attribute hidden)

          ~ conditions {
              ~ expected_value = ".*Check Name : test-env/service1:.*" -> "Pingdom"
              ~ field          = "description" -> "source"
              ~ operation      = "matches" -> "equals"
                # (1 unchanged attribute hidden)
            }
          ~ conditions {
              ~ expected_value = "Pingdom" -> ".*Check Name : test-env/service1:.*"
              ~ field          = "source" -> "description"
              ~ operation      = "equals" -> "matches"
                # (1 unchanged attribute hidden)
            }

            # (2 unchanged blocks hidden)
        }
    }

Terraform Version

Terraform v1.2.9
on darwin_arm64
+ provider registry.terraform.io/opsgenie/opsgenie v0.6.14

Affected Resource(s)

Please list the resources as a list, for example:

  • opsgenie_service_incident_rule

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions