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_alert_condition - condition_scope must be application or instance #12972

Closed
mattcanty opened this issue Mar 22, 2017 · 11 comments · Fixed by #13158
Closed

newrelic_alert_condition - condition_scope must be application or instance #12972

mattcanty opened this issue Mar 22, 2017 · 11 comments · Fixed by #13158

Comments

@mattcanty
Copy link

Terraform Version

0.9.1

Affected Resource(s)

Please list the resources as a list, for example:

  • newrelic_alert_condition

Terraform Configuration Files

data "newrelic_application" "app" {
  name = "My.Web.Api"
}

resource "newrelic_alert_policy" "foo" {
  name = "foo"
}

resource "newrelic_alert_condition" "foo" {
  policy_id = "${newrelic_alert_policy.foo.id}"

  name        = "foo"
  type        = "apm_app_metric"
  entities    = ["${data.newrelic_application.app.id}"]
  metric      = "apdex"
  runbook_url = "https://www.example.com"

  term {
    duration      = 5
    operator      = "below"
    priority      = "critical"
    threshold     = "0.75"
    time_function = "all"
  }
}

Debug Output

https://gist.github.com/matthewcanty/acbdc5b8247376b8b6803ea733b607d9

Expected Behavior

An alert policy should have been created with conditions on My.Web.Api.

Actual Behavior

An alert policy is created, including notification channel but no condition is made.

Steps to Reproduce

terraform apply

Important Factoids

My configuration is lifted from https://www.terraform.io/docs/providers/newrelic/d/application.html only I've replaced the app name with one which is valid.

@grubernaut
Copy link
Contributor

Hello @matthewcanty, thanks for the issue!
It looks like the newrelic API either changed, or there is an upstream difference between the go-sdk we use and the newrelic API. I searched the New Relic documentation thoroughly, and I couldn't find any hints to what condition_scope is, unfortunately. Paging @paultyng for any thoughts.

@mattcanty
Copy link
Author

@paultyng
Copy link
Contributor

I'll try to take a look later today, their admin API is pretty lacking in documentation, looks like maybe we can just at least default it to application for now maybe?

@grubernaut
Copy link
Contributor

@paultyng that'd be okay with me, if we're sure that instance isn't used for anything. Want to make that change in the SDK, and we'll update the vendor?

@paultyng
Copy link
Contributor

Weirdly that field does show up in their API explorer, with zero documentation around it.

Let me contact their support and ask whats up.

@grubernaut
Copy link
Contributor

@paultyng awesome, that'd be best ❤️ thanks!

@paultyng
Copy link
Contributor

Per New Relic support:

After doing a bit of investigation, it looks like your account is enrolled in a few of our new features, specifically "JVM Instance-based alerting".
This is the reason why this account is expecting the condition_scope value. Because of having the feature enabled to select JVM instance or application, you will need to pass in one additional key:value pair to the condition payload to specify whether you would like violations scoped to the application or an individual JVM. This means you need to add the condition_scope to the condition object and pass it the value of either application or instance.

So I'll get this added to the SDK library as an omitempty and we can update the vendor and fix it.

@paultyng
Copy link
Contributor

Same link as above, but at least an explanation as to why its only sometimes an issue.

@grubernaut
Copy link
Contributor

Ah that's awesome, thanks for digging into that!

@paultyng
Copy link
Contributor

PR submitted on #13158 that works with this field now.

@ghost
Copy link

ghost commented Apr 14, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants