Policies Recreating Every Apply in New Relic V2

In transitioning to v2, NR policies that are not recreated with 1.19 are recreating in 2.1.1 for each apply (against terraform 0.12.26 as the docker image for 0.13 is not available yet). It’s unclear what reason what is the reason it is now being forced to recreate. Here’s some of the relevant code:

locals {
  service            = "Service Template"
}
 resource "pagerduty_service_integration" "new-relic" {
      name    = data.pagerduty_vendor.new-relic.name
      service = pagerduty_service.pd_service.id
      vendor  = data.pagerduty_vendor.new-relic.id
    } 

       resource "newrelic_alert_channel" "alert_channel" {
      name              = "Pagerduty to ${local.service}"
      type              = "pagerduty"
      config {
        service_key = pagerduty_service_integration.new-relic.integration_key
      }

      lifecycle {
        ignore_changes = [config]
      }
    }

    resource "newrelic_alert_policy" "lowconf-policy" {
      name                = "${local.service} LOW-CONFIDENCE (automated)"
      channel_ids         = [newrelic_alert_channel.alert_channel.id]
      incident_preference = "PER_CONDITION_AND_TARGET"
    }

Hi, thank you for the report. Can you also post the output of the apply please? I have a stable alert_policy example locally that works without issue, so narrowing down on what is different about your environment will help me reproduce the issue.

So it looks like they just get modified and the impact might just be a longer plan/apply where terraform looks to update all of my policies. This is from the plan:

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # module.service-ime.newrelic_alert_policy.coldpath-policy will be updated in-place
  ~ resource "newrelic_alert_policy" "coldpath-policy" {
      - account_id          = 1226690 -> null
        channel_ids         = [
            3697110,
        ]
        id                  = "942368"
        incident_preference = "PER_CONDITION_AND_TARGET"
        name                = "IME Team COLD PATH (automated)"
    }

  # module.service-ime.newrelic_alert_policy.critical-policy will be updated in-place
  ~ resource "newrelic_alert_policy" "critical-policy" {
      - account_id          = 1226690 -> null
        channel_ids         = [
            3697109,
        ]
        id                  = "942371"
        incident_preference = "PER_CONDITION_AND_TARGET"
        name                = "IME Team CRITICAL (automated)"
    }

  # module.service-ime.newrelic_alert_policy.highpri-policy will be updated in-place
  ~ resource "newrelic_alert_policy" "highpri-policy" {
      - account_id          = 1226690 -> null
        channel_ids         = [
            3697109,
        ]
        id                  = "942372"
        incident_preference = "PER_CONDITION_AND_TARGET"
        name                = "IME Team HIGH-PRIORITY (automated)"
    }
1 Like

@zleslie I have opened up a similar issue are you able to reproduce this? Is this going to be fixed soon? thanks