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

`newrelic_notification_destination` Resource: Alert destinations are created multiple times, possibly due to retries #2678

Open atkinchris opened 1 month ago

atkinchris commented 1 month ago

When applying Terraform to create Alert destinations, they are created multiple times.

$ terraform -v

Terraform v1.8.4
on darwin_arm64
+ provider registry.terraform.io/newrelic/newrelic v3.36.0
resource "newrelic_notification_destination" "service_now_prod" {
  name = "Service Now - Official Destination"
  type = "SERVICE_NOW"

  account_id = <REDACTED>

  property {
    key   = "url"
    value = <REDACTED>
  }

  property {
    key   = "two_way_integration"
    value = "true"
  }

  auth_basic {
    user     = <REDACTED>
    password = <REDACTED>
  }
}

Actual behaviour

When applying Terraform to create Alert destinations, the destinations are created multiple times. This is consistent, even if no "retries" error is shown.

$ terraform apply

newrelic_notification_destination.service_now_pre_prod: Creating...
newrelic_notification_destination.service_now_prod: Creating...
newrelic_notification_destination.service_now_pre_prod: Creation complete after 8s [id=<REDACTED>]
newrelic_notification_destination.service_now_prod: Still creating... [10s elapsed]
newrelic_notification_destination.service_now_prod: Still creating... [20s elapsed]
newrelic_notification_destination.service_now_prod: Still creating... [30s elapsed]
newrelic_notification_destination.service_now_prod: Still creating... [40s elapsed]
╷
│ Error: maximum retries reached: An error occurred resolving this field
│
│   with newrelic_notification_destination.service_now_prod,
│   on service_now.tf line 16, in resource "newrelic_notification_destination" "service_now_prod":
│   16: resource "newrelic_notification_destination" "service_now_prod" {
│
│ NOTICE: fields are statically typed. Make sure all fields are of the correct type
╵
Screenshot 2024-05-29 at 11 17 05

Expected behaviour

Each resource is created exactly once, deterministically.

atkinchris commented 1 month ago

I have a suspicion this is coming from New Relic attempting to verify the passed Service Now credentials, timing out silently - and causing a retry.

pranav-new-relic commented 1 month ago

Thank you for reporting this, @atkinchris, this sounds like a bug which needs to be investigated into, further. The team shall be triaging this issue soon, based on the current priority queue; and shall reach out to you for more information, if needed :)

cc @amaor-newrelic