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

NRQL Alert Condition Term Duration shouldn't be limited to [1 2 3 4 5 10 15 30 60 120] #169

Closed
nejoyer opened this issue Sep 4, 2019 · 2 comments

Comments

@nejoyer
Copy link
Contributor

nejoyer commented Sep 4, 2019

Terraform Version

Terraform v0.12.7

  • provider.newrelic v1.5.1

Affected Resource(s)

newrelic_nrql_alert_condition

Terraform Configuration Files

provider "newrelic" {
  api_key = "[redacted]"
}

resource "newrelic_alert_policy" "neil_test" {
  name                = "NEILTEST"
  incident_preference = "PER_CONDITION"
}

resource "newrelic_nrql_alert_condition" "neil_test_conidtion" {
  policy_id = "${newrelic_alert_policy.neil_test.id}"
  name      = "neil test name"
  term {
    duration      = "25"
    threshold     = "5"
    operator      = "above"
    priority      = "critical"
    time_function = "all"
  }
  nrql {
    query       = "select count(*) from transaction"
    since_value = "3"
  }
  value_function = "single_value"
}

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform plan

Expected Behavior

It should show me the plan that would create that nrql alert condition.

Actual Behavior

Error: expected term.0.duration to be one of [1 2 3 4 5 10 15 30 60 120], got 25

Other Details

The New Relic UI lets you type in a number, not choose from a dropdown, so we already have alerts that work well that are configured to 25 minutes. So as I try to get them tracked in terraform, it means I'll have to change the alerts. Ideally, it would just validate on that the number is in the range [1-120].

Importing an alert that is configured to 25 minutes in the UI works, and the state shows 25 minutes, but I can't do terraform plan because that blows up.

References

Pretty sure this is the line of code:
https://github.com/terraform-providers/terraform-provider-newrelic/blob/8aae17feff1d5cd193adbfba04459a003aeed571/newrelic/resource_newrelic_nrql_alert_condition.go#L78

@jamesgoodhouse
Copy link
Contributor

PR https://github.com/terraform-providers/terraform-provider-newrelic/pull/178 addresses this issue

@ctrombley
Copy link
Contributor

This was included in the v1.5.2 release.

@ctrombley ctrombley reopened this Nov 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants