Closed mike-davis-sada closed 1 year ago
We are looking into this but have.a couple of questions and requests for more information:
Please provider a link to a GitHub Gist containing the complete debug output: https://www.terraform.io/docs/internals/debugging.html. Please do NOT paste the debug output in the issue; just paste a link to the Gist.
Hi, we haven’t heard back from you in a long time so we will close the ticket. If you feel this is still a valid request or bug, feel free to create a new issue.
[x] Your New Relic
provider
configuration (sensitive details redacted) terraform {Require the latest 3.6.x+ version of the New Relic provider
required_providers { newrelic = { source = "newrelic/newrelic" version = "~> 3.6.1" } } }
provider "newrelic" { account_id = XXX # Your New Relic account ID api_key = "XXX" # Your New Relic user key region = "US" # US or EU (defaults to US) }
[x] A list of affected resources and/or data sources newrelic_alert_channel
[x] The configuration of the resources and/or data sources related to the bug report (i.e. from the list mentioned above) resource "newrelic_alert_channel" "alert_notification_email" { name = "me@myemail.com" type = "email"
config { recipients = "me@myemail.com" include_json_attachment = "1" } }
[x] Description of the current behavior (the bug) While creating the newrelic_alert_channel, it gives up after 4 attempts.
[x] Description of the expected behavior Expected behavior is that the resource is created.
[x] Any related log output newrelic_alert_policy.alert_policy_name: Creating... newrelic_alert_channel.alert_notification_email: Creating... newrelic_alert_policy.alert_policy_name: Creation complete after 0s [id=3688947] newrelic_nrql_alert_condition.average-duration: Creating... newrelic_nrql_alert_condition.average-duration: Creation complete after 4s [id=3688947:28442601] ╷ │ Error: POST https://api.newrelic.com/v2/alerts_channels.json giving up after 4 attempt(s) │ │ with newrelic_alert_channel.alert_notification_email, │ on notification-channel.tf line 2, in resource "newrelic_alert_channel" "alert_notification_email": │ 2: resource "newrelic_alert_channel" "alert_notification_email" { │
Terraform Version
Run
terraform -v
to show the version. If you are not running the latest version of Terraform, please upgrade because your issue may have already been fixed. ❯ terraform -v Terraform v1.3.3 on darwin_arm64Affected Resource(s)
Please list the resources as a list, for example:
newrelic_alert_channel
If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.
Terraform Configuration
provider "newrelic" { account_id = XXX # Your New Relic account ID api_key = "NRAK-XXX" # Your New Relic user key region = "US" # US or EU (defaults to US) }
data "newrelic_entity" "foodme" { name = "FoodMe" # Must be an exact match to your application name in New Relic domain = "APM" # or BROWSER, INFRA, MOBILE, SYNTH, depending on your entity's domain type = "APPLICATION" }
NRQL alert condition
resource "newrelic_nrql_alert_condition" "average-duration" { policy_id = newrelic_alert_policy.alert_policy_name.id type = "static" name = "Average(Duration)" description = "Alert when transactions are taking too long" runbook_url = "https://www.example.com" enabled = true violation_time_limit_seconds = 3600
nrql { query = "SELECT average(duration) FROM Transaction where appName = '${data.newrelic_entity.foodme.name}'" // DEPRECATED evaluation_offset = 3 }
critical { operator = "above" threshold = 5.5 threshold_duration = 300 threshold_occurrences = "ALL" } }
Notification channel
resource "newrelic_alert_channel" "alert_notification_email" { name = "miked@sada.com" type = "email"
config { recipients = "miked@sada.com" include_json_attachment = "1" } }
Link the above notification channel to your policy
resource "newrelic_alert_policy_channel" "alert_policy_email" { policy_id = newrelic_alert_policy.alert_policy_name.id channel_ids = [ newrelic_alert_channel.alert_notification_email.id ] }
resource "newrelic_alert_policy" "alert_policy_name" { name = "Alert Policy - ${data.newrelic_entity.foodme.name}" }