terraform-provider-newrelic: TF apply fails on `newrelic_nrql_alert_condition`
- Your New Relic
providerconfiguration (sensitive details redacted) - A list of affected resources and/or data sources
- The configuration of the resources and/or data sources related to the bug report (i.e. from the list mentioned above)
- Description of the current behavior (the bug)
- Description of the expected behavior
- Any related log output
Terraform Version
terraform {
required_version = "1.4.5"
required_providers {
newrelic = {
source = "newrelic/newrelic"
version = "3.20.2"
}
}
}
Affected Resource(s)
newrelic_nrql_alert_condition
Terraform Configuration
# Too much information to redact. We have thousands of lines of terraform. Here's an example:
# NEW_RELIC_ACCOUNT_ID is set as an environment variable
data "newrelic_entity" "ecs_app" {
name = var.new_relic_alerts_app_name # 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"
}
resource "newrelic_alert_policy" "nr_alerts_policy" {
name = var.new_relic_alerts_app_name
incident_preference = "PER_POLICY" # PER_POLICY is default
}
resource "newrelic_nrql_alert_condition" "api_error_percentage" {
policy_id = data.newrelic_alert_policy.nr_alerts_policy.id
type = "static"
name = "${var.new_relic_alerts_app_name} - Error Percentage"
enabled = true
violation_time_limit_seconds = 259200
nrql {
query = "SELECT count(apm.service.error.count) / count(apm.service.transaction.duration) AS 'All errors' FROM Metric WHERE entity.guid = '${data.newrelic_entity.ecs_app.guid}' FACET `host`"
}
warning {
operator = "above"
threshold = 3
threshold_duration = 300
threshold_occurrences = "all"
}
fill_option = "none"
aggregation_window = 60
aggregation_method = "event_flow"
aggregation_delay = 120
}
This was functioning ~7 hours ago as of this writing. Nothing has changed in our terraform, and no one has made any manual changes to our alerting policies, conditions, or APM entities.
Actual Behavior
╷
│ Error: Unknown Error
│
│ with module.redacted.module.ecs_task.module.new_relic_api_service_alerts[0].newrelic_nrql_alert_condition.api_error_percentage,
│ on ../terraform-shared-modules/new-relic-api-alerts/main.tf line 119, in resource "newrelic_nrql_alert_condition" "api_error_percentage":
│ 119: resource "newrelic_nrql_alert_condition" "api_error_percentage" {
│
╵
Error: Process completed with exit code 1.
Expected Behavior
Nothing at all. No errors. The resources were created in the past, and have been left alone for weeks or months.
Steps to Reproduce
terraform applyorterraform plan
Debug Output
- See actual behavior.
Panic Output
- See actual behavior.
Important Factoids
- This was working hours ago with provider version
3.14.0. We tried version3.20.2to see if that would fix, but it didn’t. - We first noticed these errors happening around 3 hours ago as of this writing
- We also tried deleting specific conditions, or entire policies, and we would see them recreated by terraform (so our license / User API key is valid) but still would see the errors.
- This happens on both
applyandplan
References
- Different affected area, but possibly related? https://github.com/newrelic/terraform-provider-newrelic/issues/2342
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 14
- Comments: 24 (9 by maintainers)
Thank you @piekstra . Closing the issue as it is resolved.
Resolved for our pipelines also.
@RavitejaSurampudi all good from my side. Thank you very much!
Thanks it has been fixed.
That’s fixed it for our pipelines, thank you!
@Lizzam / @notshof Could you try now and check if you are facing the issue still ?
Thank you @piekstra . we will analyse and update you ASAP.
@piekstra Thank you for bringing this to our notice. we are looking into this now.
We have the same issue here. It was working properly earlier today.