Terraform-provider-newrelic: Max Char Allowed for name in Entity Tag Data Source does not Match Max Char Allowed for name in Synthetic Monitor

Created on 10 Jul 2020  路  3Comments  路  Source: newrelic/terraform-provider-newrelic

Terraform Version

0.12.28

Affected Resource(s)

  • data.newrelic_entity_tags
  • resource.newrelic_entity_tags

Terraform Configuration Files

data "newrelic_entity" "entity" {
  name = "${var.name} - ${var.uri}"
}

resource "newrelic_entity_tags" "tags" {
  guid = data.newrelic_entity.entity.guid

  dynamic "tag" {
    for_each = var.tags
    content {
      key    = tag.key
      values = list(tag.value)
    }
  }
}

ERROR

Expected Behavior

terraform plan should succeed

Actual Behavior

Got an Error in terraform plan (redacted the monitor name)

Error: Provided filter: name LIKE 'Very Long Monitor Name that is 196 chars long' is not a valid NRQL query (The search term for EntitySearchIdentifier(value=name, tagsIdentifier=false) is 196 chars long, the maximum allowed is 150), null
--
1373 | 聽
1374 | on modules/synth_script_az/main.tf line 48, in data "newrelic_entity" "entity":
1375 | 48: data "newrelic_entity" "entity" {

Steps to Reproduce

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

  1. existing synthetics monitor with name more than 150 chars
  2. use entity_tags data source to get entity_tag_id
  3. terraform plan

Most helpful comment

@sanderblue - Yes I have made some changes to my code to shorten the name of the Synthetic to workaround this issue. Thank you for replying.

All 3 comments

Hi @MAN98, thanks for reporting this. This looks like an upstream API issue. This is likely due to the differences between the Synthetics REST API and NerdGraph API. If I recall correctly, monitors created via the New Relic UI are created with the REST API which doesn't seem to contain this kind of validation. The newrelic_entity data source leverages NerdGraph which contains the server-side validation.

We'll pass this information to the NerdGraph team so they are aware of this.

In the meantime, would it be possible to shorten your monitor names from the UI? That could be a bit much depending on how many monitors your account has. There's also the option of editing via a script that utilizes the REST API.

@sanderblue - Yes I have made some changes to my code to shorten the name of the Synthetic to workaround this issue. Thank you for replying.

Great thanks. Closing given this is an issue with an upstream API

Was this page helpful?
0 / 5 - 0 ratings