logicmonitor / terraform-provider-logicmonitor

Terraform LogicMonitor provider.
https://registry.terraform.io
Mozilla Public License 2.0
24 stars 16 forks source link

Escalation Chains Visual Bug #94

Closed jrigby-bca closed 3 weeks ago

jrigby-bca commented 3 months ago

Using the following code we have managed to setup an escalation chain that emails an address all day, then emails another address between 08:00 and 18:00 BST Monday to Friday, then Saturday Sunday All day.

# Create a LogicMonitor escalation chain
resource "logicmonitor_escalation_chain" "networks_itoc_ooh" {
  name        = "Networks & OOH ITOC"
  description = "Alerts for networks and escalated to itoc oohs"
  destinations = [
    {
      period = [],
      stages = [
        module.common.network_escalation_chain_contact,
      ]
      type = "single"
    },
    {
      period = [{
        week_days     = [ 2, 3, 4, 5, 6]
        timezone      = "Europe/London"
        start_minutes = 480
        end_minutes   = 1080
      }],
      stages = [
        module.common.itoc_escalation_chain_contact,
      ]
      type = "timebased"
    },
    {
      period = [{
        week_days     = [1, 7]
        timezone      = "Europe/London"
        start_minutes = 0
        end_minutes   = 1440
      }],
      stages = [
        module.common.itoc_escalation_chain_contact,
      ]
      type = "timebased"
    }
  ]
  enable_throttling = false
  throttling_alerts = 20
  throttling_period = 10
}

output "networks_itoc_ooh_chain_id" {
  value = logicmonitor_escalation_chain.networks_itoc_ooh.id
}

Now when this is then created in LogicMonitor, under escalation chains the UI begins to behave weirdly. In BOTH UIs the escalation chain reports it is not time based and is missing configuration data, leading the end user to believe from a glance its all ok but then when managing its broken.

UIV3: So from here this all looks normal: image

However when we click manage we are presented with: image

UIV4: So from here this all looks normal: image

However when we click manage we are presented with: image

API Response: When getting a response for this escalation chain via the API , we are presented with the following, this tells me this looks to be a visual bug and the chain is all going to work as intended.

{
  "id" : 14,
  "name" : "Networks & OOH ITOC",
  "description" : "Alerts for networks and escalated to itoc oohs",
  "enableThrottling" : false,
  "throttlingPeriod" : 10,
  "throttlingAlerts" : 20,
  "inAlerting" : false,
  "destinations" : [ {
    "type" : "single",
    "period" : null,
    "stages" : [ [ {
      "type" : "ARBITRARY",
      "method" : "email",
      "addr" : "emailAddress",
      "contact" : ""
    } ] ]
  }, {
    "type" : "timebased",
    "period" : {
      "startMinutes" : 480,
      "endMinutes" : 1080,
      "timezone" : "Europe/London",
      "weekDays" : [ 2, 3, 4, 5, 6 ]
    },
    "stages" : [ [ {
      "type" : "ADMIN",
      "method" : "ServiceNow DEV Integration",
      "addr" : "ServiceNow",
      "contact" : ""
    }, {
      "type" : "ARBITRARY",
      "method" : "email",
      "addr" : "emailAddress",
      "contact" : ""
    } ] ]
  }, {
    "type" : "timebased",
    "period" : {
      "startMinutes" : 0,
      "endMinutes" : 1440,
      "timezone" : "Europe/London",
      "weekDays" : [ 1, 7 ]
    },
    "stages" : [ [ {
      "type" : "ADMIN",
      "method" : "ServiceNow DEV Integration",
      "addr" : "ServiceNow",
      "contact" : ""
    }, {
      "type" : "ARBITRARY",
      "method" : "email",
      "addr" : "emailAddress",
      "contact" : ""
    } ] ]
  } ],
  "ccDestinations" : [ ]
}
jrigby-bca commented 3 months ago

Version Output

PS C:\Repos\LogicMonitor> terraform -v  
Terraform v1.9.0
on windows_386
+ provider registry.terraform.io/hashicorp/azurerm v3.110.0
+ provider registry.terraform.io/logicmonitor/logicmonitor v2.0.16
lm-madhvi commented 2 months ago

Hi @jrigby-bca , You are encountering this issue because you are trying to infer type = "single" for a chain while all other chains are time-based. This configuration is not possible through the UI either; you can only create either a time-based chain or a single chain. Here’s the problematic code segment:

{ period = [], stages = [ module.common.network_escalation_chain_contact, ] type = "single" }