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

opsgenie_escalation: incorrect example in the documentation

Open javefang opened this issue 3 years ago • 0 comments

Hi there,

The example usage for opsgenie_escalation for multiple recipient seems wrong on https://registry.terraform.io/providers/opsgenie/opsgenie/latest/docs/resources/escalation#example-usage

If you apply the hcl in the example, it will create an escalation with only one level of escalation (the last one)

resource "opsgenie_escalation" "test" {
  name          = "genieescalation-%s"
  description   = "test"
  owner_team_id = "${opsgenie_team.test.id}"

  rules {
    condition   = "if-not-acked"
    notify_type = "default"
    delay       = 1

    recipient {
      type = "user"
      id   = "${opsgenie_user.test.id}"
    }

    recipient {
      type = "team"
      id   = "${opsgenie_team.test.id}"
    }

    recipient {
      type = "schedule"
      id   = "${opsgenie_schedule.test.id}"
    }
  }

  repeat  {
    wait_interval          = 10
    count                  = 1
    reset_recipient_states = true
    close_alert_after_all  = false
  }
}

To get the correct behavior (3 escalation levels), it should be

resource "opsgenie_escalation" "test" {
  name          = "genieescalation-%s"
  description   = "test"
  owner_team_id = "${opsgenie_team.test.id}"

  rules {
    condition   = "if-not-acked"
    notify_type = "default"
    delay       = 1

    recipient {
      type = "user"
      id   = "${opsgenie_user.test.id}"
    }
  }

  rules {
    condition   = "if-not-acked"
    notify_type = "default"
    delay       = 1

    recipient {
      type = "team"
      id   = "${opsgenie_team.test.id}"
    }
  }

  rules {
    condition   = "if-not-acked"
    notify_type = "default"
    delay       = 1

    recipient {
      type = "schedule"
      id   = "${opsgenie_schedule.test.id}"
    }
  }

  repeat  {
    wait_interval          = 10
    count                  = 1
    reset_recipient_states = true
    close_alert_after_all  = false
  }
}

Terraform Version

NA

Affected Resource(s)

opsgenie_escalation

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration Files

Debug Output

NA

Panic Output

NA

Expected Behavior

What should have happened?

Actual Behavior

What actually happened?

Steps to Reproduce

NA

Important Factoids

NA

References

javefang avatar Dec 09 '21 16:12 javefang