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

Cannot add schedule and user as recipients on opsgenie_escalation resource #352

Open robbo1996 opened 1 year ago

robbo1996 commented 1 year ago

Hi there,

I've noticed a bug when tryind to add a schedule and a user to an escalation. If just the schedule is added as a recipient it works fine, if just the user is added it works fine but when both are added as recipients only the user gets added in the console despite the plan looking correct. The plan looks as if both will be added but when applied it doesn't work as expected. Following the documentation here - https://registry.terraform.io/providers/opsgenie/opsgenie/latest/docs/resources/escalation

Terraform Version

1.3.1

Affected Resource(s)

opsgenie_escalation

Terraform Configuration Files

resource "opsgenie_escalation" "escalation" {
  name        = "escalation"
  description = "description"

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

    recipient {
      type = "schedule"
      id   = opsgenie_schedule.some_schedule.id
    }
    recipient {
      type = "user"
      id   = "user-id-here"
    }
  }
}

Expected Behavior

# opsgenie_escalation.escalation will be updated in-place
 resource "opsgenie_escalation" "escalation" {
        id            = "resource-id-here"
        name          = "escalation"
        # (1 unchanged attribute hidden)

      ~ rules {
            # (3 unchanged attributes hidden)

          + recipient {
              + id   = "user-id-here"
              + type = "user"
            }

            # (1 unchanged block hidden)
        }
    }

Actual Behavior

The user replaces the schedule rather than being added as an additional recipient upon a terraform apply

shawn2506 commented 1 year ago

I am as well encountering the same issue... Another bug is we have multiple schedules as recipients then there is no property to mention which schedule should be in use, however from console we can create selection policies routing to multiple policies