Terraform-provider-newrelic: newrelic_nrql_alert_condition "Provider produced inconsistent result after apply" error with 1.17 on Terraform 0.12

Created on 4 May 2020  路  4Comments  路  Source: newrelic/terraform-provider-newrelic

When applying newrelic_nrql_alert_condition using Terraform 0.12 I get a terraform error about inconsistency:

Error: Provider produced inconsistent result after apply

When applying changes to
newrelic_nrql_alert_condition.lambda_invocations, provider
"registry.terraform.io/-/newrelic" produced an unexpected new value for was
present, but now absent.

This is a bug in the provider, which should be reported in the provider's own
issue tracker.

I see 0.17 included a number of commits around alerts, but I've not been able to pinpoint a culprit

Terraform Version

0.12.24 (only version of 12 I've tried)

Affected Resource(s)

  • newrelic_nrql_alert_condition

Terraform Configuration Files

I can't include these as they contain commercially sensitive information, but this is an approximation:

resource "newrelic_nrql_alert_condition" "lambda_invocations" {
  policy_id = data.terraform_remote_state.shared.outputs.newrelic_alert_policy_id

  name = "Lambda not invoked

  term {
    duration      = 10
    operator      = "equal"
    priority      = "critical"
    threshold     = "0"
    time_function = "all"
  }

  nrql {
    query       = "FROM AwsLambdaInvocation SELECT count(*) WHERE provider.functionName = '${local.lambda_name}'"
    since_value = "5"
  }
}

Expected Behavior

It should have applied the plan correctly

Actual Behavior

Terraform errorred with

Error: Provider produced inconsistent result after apply

When applying changes to
newrelic_nrql_alert_condition.lambda_invocations, provider
"registry.terraform.io/-/newrelic" produced an unexpected new value for was
present, but now absent.

This is a bug in the provider, which should be reported in the provider's own
issue tracker.

Steps to Reproduce

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

  • Apply a plan containing a nrql alert resource using Terraform 0.12 and NR provider 1.16
  • Apply the same plan using the previous step's state using using Terraform 0.12 and NR provider 1.17
bug upstream

Most helpful comment

Looks like a bug in Paging was introduced in newrelic-client-go 0.20.0 where URLs handling was rebuild based on Region. https://github.com/newrelic/newrelic-client-go/pull/287

All 4 comments

We're having to workaround this by setting:

required_providers {
    newrelic = "~> 1.16.0"
}

Looks like a bug in Paging was introduced in newrelic-client-go 0.20.0 where URLs handling was rebuild based on Region. https://github.com/newrelic/newrelic-client-go/pull/287

Can confirm using the latest provider 1.17.1 fixes this issue :)

Excellent! Thank you all for the report, testing and confirmation of resolution.

Was this page helpful?
0 / 5 - 0 ratings