terraform-provider-newrelic: Error: expected entity tag team to have been updated but was not found

Please include the following with your bug report

⚠️ Important: Failure to include the following, such as omitting the Terraform configuration in question, may delay resolving the issue.

Terraform Version

Terraform v1.0.11
on linux_amd64
+ provider registry.terraform.io/newrelic/newrelic v2.34.0

Affected Resource(s)

  • newrelic_entity_tags.nr_dashboard_tags

issue seen v2.30.0, v2.30.2 and v2.34.0

Terraform Configuration

https://gist.github.com/thedebugger/2e26fbb8ca484d464a0701f98f8a0d27

Actual Behavior

terraform errored with " expected entity tag team to have been updated but was not found"

Expected Behavior

terraform should update the nr_dashboard_tags accordingly

Steps to Reproduce

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

  1. Create nr_one_dashboard and nr_dashboard_tags
  2. Delete the dashboard resource manually from state file and from NR (or manually change the nr_dashboard_tags to something non-existent)
  3. run terraform apply

Debug Output

Can provide debug output if required since we have hundred of resources. But here are the info logs https://gist.github.com/thedebugger/2e26fbb8ca484d464a0701f98f8a0d27

Important Factoids

no

References

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 27 (12 by maintainers)

Commits related to this issue

Most upvoted comments

This was raised with the alerting team internally as there is nothing we can do on the Terraform side to fix this issue. As mentioned retry mechanism timeout has been raised to 60 seconds which will hopefully avoid the error we’ve been seeing.

As there is no action we can take on the Terraform side we will close the ticket. Feel free to continue the discussion if needed.

I had tried it with parallelism=2 back when I encountered this issue early last month, and doing that did not remove the error (i.e. yes, I still saw the issue then). I haven’t come back to it since. We did work around it by using python to generate a terraform file with no looping, just a separate structure for each item.

Just an update on this. This happens only when you use count or for_each on the resource (creating multiple newrelic_entity_tags resources). Apparently, creating multiple tags using a single newrelic_entity_tags resource would not produce described behavior. One way to circumvent this is to create separate newrelic_entity_tags resource for each entity and to use Terraform dynamic keyword on the tag block. EXAMPLE:

locals {
  tags = [{
    key = "team",
    values = [var.team]
  }, {
    key = "service",
    values = [var.service]
  }]
}

resource "newrelic_entity_tags" "this" {
  guid = newrelic_nrql_alert_condition.this.entity_guid

  dynamic "tag" {
    for_each = local.tags

    content {
      key = tag.value["key"]
      values = tag.value["values"]
    }
  }
}

Yes, this was on the latest version. I setup autopatching for a reason.

I’m quitting this job Friday, so how would I generate a debug log?

I will confirm that we are still seeing this issue in Terraform provider version 3.0.2

s: Still creating… [20s elapsed] ╷ │ Error: expected entity tag type to have been updated but was not found │ │ with module.cluster_alerts.module.synthetic_slash_alert.newrelic_entity_tags.this_tags, │ on …/modules/newrelic_alert/main.tf line 51, in resource “newrelic_entity_tags” “this_tags”: │ 51: resource “newrelic_entity_tags” “this_tags” {

resource "newrelic_entity_tags" "this_tags" {
  guid = newrelic_nrql_alert_condition.this.entity_guid

  tag {
    key = "Environment"
    values = [var.environment]
  }

  dynamic "tag" {
    for_each = var.tags
    content {
      key = tag.key
      values = try(
        [tostring(tag.value)],
        tolist(tag.value),
      )
    }
  }
}
  tags = {
    type = "synthetic"
  }
}