Closed apr-1985 closed 1 year ago
Hi @apr-1985 , we'll investigate this issue. Can you share more details about the changes you made to the webhook destination?
Hi thanks for picking this up. It looks to be an issue with the 3.7.1 plugin and a destination with no basic auth.
The minimum TF to reproduce is
terraform {
required_version = ">= 1.2.0"
required_providers {
newrelic = {
source = "newrelic/newrelic"
version = "3.7.1"
}
}
}
provider "newrelic" {
account_id = local.newrelic_account_number
api_key = local.newrelic_api_key # usually prefixed with 'NRAK'
region = "US" # Valid regions are US and EU
}
resource "newrelic_notification_destination" "test-destination" {
name = "test-destination-webhook"
type = "WEBHOOK"
property {
key = "url"
value = "https://my-url.com"
}
lifecycle {
ignore_changes = [
auth_basic
]
}
}
Run this and the destination is setup. Then in the NR One UI change the url to https://my-url1234.com
and apply the TF again and it will crash the plugin.
Upgrade the plugin to 3.8.0 and apply and it will crash the 3.8.0 plugin.
However. If you start off with the 3.8.0 plugin for the initial apply the problem does not surface.
Seems some basic auth changes were made in the file newrelic/structures_newrelic_notifications_destination.go
between the versions
https://github.com/newrelic/terraform-provider-newrelic/compare/v3.7.1...v3.8.0#diff-546e1a3f9ce991f6dc58616554de9154a3f4360f8a1d8bd20b48a30a0d8d8ab9
As it is working when using 3.8.0 initially (although I cannot figure out why it still crashes when upgrading to 3.8.0) I will leave it to you as to the next steps.
Hi @apr-1985 ,
We did add a bug fix to version 3.8.0, which causes this error when you have the ignore_changes
flag on your resource.
We opened a bug for it and will work on it in the near future. In the meanwhile you can re-import the destination to your state file with the following steps:
terraform state show newrelic_notification_destination.test-destination
- Copy the destination idterraform state rm newrelic_notification_destination.test-destination
terraform import newrelic_notification_destination.test-destination <destination_id>
Hope this helps and I'll update when this bug is fixed.
The solution mentioned above is the best we can do. Closing this issue.
I have a webhook destination that is created by Terraform. I made a manual change to the destination to test some things and then ran the Terraform again to set it back to how it should be. However the provider just crashes with the error below.
I tried removing the destination from the state manually correcting the drift and re-importing however the provider still wanted to make changes to the resource and so crashed.
Bit stuck now as I cannot destroy the destination without destroying my whole alerting stack of policies and conditions etc.
tested with provider version 3.8.0.