newrelic / terraform-provider-newrelic

Terraform provider for New Relic
https://registry.terraform.io/providers/newrelic/newrelic/latest/docs
Mozilla Public License 2.0
200 stars 244 forks source link

Resource `newrelic_synthetics_monitor`: This field is deprecated! Please use `relatedEntities` instead error #2692

Closed andrewsison-filevine closed 5 days ago

andrewsison-filevine commented 2 weeks ago

Hello!

We've been getting issues randomly with the newrelic_synthetics_monitor resource. Any help would be much appreciated!

Terraform Configuration

resource "newrelic_synthetics_monitor" "selfchecks" {
  for_each            = { for check in var.checks : check.url => check }
  type                = "SIMPLE"
  status              = coalesce(each.value.status, upper(var.newrelic_monitor_status))
  name                = "${var.env}: ${each.value.name}"
  uri                 = "https://${var.subdomain}.${var.dns_domain}${each.value.url}"
  period              = lookup(local.resolution_interval_compat_map, each.value.resolution, "EVERY_5_MINUTES")
  bypass_head_request = true
  validation_string   = each.value.validation_str

  # Compat shim for v2.x of provider, which used AWS_ prefixes
  locations_public = [for loc in each.value.locations : replace(loc, "/^AWS_/", "")]
}

actual-behavior

Error: maximum retries reached: NRDB query duration exceeded the set timeout, NRDB query duration exceeded the set timeout, NRDB query duration exceeded the set timeout, This field is deprecated! Please use `relatedEntities` instead. 
  with newrelic_synthetics_monitor.selfcheck_monitors["/check"], 
  on checks.tf line 1, in resource "newrelic_synthetics_monitor" "selfchecks": 
   1: resource "newrelic_synthetics_monitor" "selfchecks" { 

Terraform Version

~>3.25.0

Affected Resource(s)

Important Factoids

The checks list contains 25+ elements.

References

Related to:

pranav-new-relic commented 2 weeks ago

Hi @andrewsison-filevine, thank you for reporting this issue. I've tried reproducing the issue with a configuration 99% similar to that of yours, but don't seem to be seeing the issue upon terraform apply (first instance of applying or subsequent applies too), or a terraform plan - trying to apply 30+ monitors seems to perfectly succeed without any issue.

Like you might have seen our response in the issue you've linked, I would suspect that this also is a similar case of flakey API behaviour, considering you also mention you're seeing these issues at random. I would think this might have been caused by temporary API behaviour leading to this, so I'd suggest you to run this again and let us know if you see it again - you'll also see in the previous issue that the reporter magically ended up not being able to reproduce :)

If you end up seeing this again, a potential workaround (again, as suggested in this issue) is to reduce parallelism and try applying again.

Let us know if you're still seeing this issue (in which case, it might be a good idea to attach logs, as described in (3) here). Thanks!

pranav-new-relic commented 5 days ago

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.