Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

newrelic_workflow: add (priority-)filter on destination block level #2528

Open
louhnmn opened this issue Dec 22, 2023 · 0 comments
Open

newrelic_workflow: add (priority-)filter on destination block level #2528

louhnmn opened this issue Dec 22, 2023 · 0 comments

Comments

@louhnmn
Copy link

louhnmn commented Dec 22, 2023

Feature Description

In a workflow, add the ability to set a filter for each channel so you can have alerts sent to different channels/destinations based on priority/severity of the alert.

Describe Alternatives

  1. As alternative you can already just create another workflow so in the end you would have two workflows.
    One for warnings and one for criticals.

  2. You can do hacky payload stuff in your channels payload like adding:

{{#if (contains priority 'CRITICAL')}}
your_payload_here
{{/if}}

To basically making the payload falsy and thus preventing the alert being sent.
But this is not as clean obviously.

Additional context

E.g. being able to have one workflow with multiple destinations.
One destination should be triggered when an alert with priority 'HIGH' (Warning) is incoming.
Another destination should trigger when an alert with priority 'CRITICAL' is incoming.
But 'warning' alerts should not be able to trigger the 'critical' destination.

Currently you can build a workflow like this and set priority filtering on a GLOBAL workflow level but that way you can either activate alerting for CRITICAL or WARNING or BOTH but not specify the channels.
Like this:

resource "newrelic_workflow" "workflow_testing_playground" {
  name                  = "some workflow"

  destination {
    channel_id = newrelic_notification_channel.some_channel.id
  }

  issues_filter {
    name = "filter-name"
    type = "FILTER"

    predicate {
      attribute = "labels.policyIds"
      operator  = "EXACTLY_MATCHES"
      values    = ["${newrelic_alert_policy.some_policy.id}"]
    }

    predicate {
      attribute = "priority"
      operator  = "EQUAL"
      values    = ["CRITICAL"]
    }
  }

}

The proposal is to include a filter in the destination block area like this:

resource "newrelic_workflow" "workflow_testing_playground" {
  name                  = "some workflow"

  destination {
    channel_id = newrelic_notification_channel.some_channel.id
    priority_filter = ["HIGH"]
  }

  destination {
    channel_id = newrelic_notification_channel.just_another_channel.id
    priority_filter = ["CRITICAL"]
  }

  destination {
    channel_id = newrelic_notification_channel.another_channel.id
    priority_filter = ["HIGH","CRITICAL"]
  }

  issues_filter {
    name = "filter-name"
    type = "FILTER"

    predicate {
      attribute = "labels.policyIds"
      operator  = "EXACTLY_MATCHES"
      values    = ["${newrelic_alert_policy.some_policy.id}"]
    }
  }
}

so basically the same way as notification_triggers attribute is already doing. see terraform registry.

@louhnmn louhnmn changed the title workflows: add (priority-)filter on destination block level newrelic_workflow: add (priority-)filter on destination block level Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants