Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resource newrelic_nrql_alert_condition: Cannot change account ID of the resource. #2690

Open
RobertoGraham opened this issue Jun 13, 2024 · 1 comment

Comments

@RobertoGraham
Copy link

Terraform Version

1.8.5

Affected Resource(s)

  • newrelic_nrql_alert_condition

Terraform Configuration

provider "newrelic" {
  account_id = var.newrelic_account_id
  api_key    = jsondecode(data.vault_kv_secret_v2.tfvars.data_json).newrelic-api-key
  region     = "US"
}

resource "newrelic_nrql_alert_condition" "foo" {
  name        = "foo"
  policy_id   = newrelic_alert_policy.foo.id
  account_id  = var.alternate_newrelic_account_id
  description = <<EOT
  Alert.
  EOT

  nrql {
    query = <<EOT
    SELECT count(*)
    FROM Metric
    EOT
  }

  critical {
    operator              = "above"
    threshold             = 5
    threshold_duration    = 300
    threshold_occurrences = "at_least_once"
  }
}

Actual Behavior

When applying the below plan, the below error was surfaced by Terraform.

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  ~ update in-place
Terraform will perform the following actions:
  # newrelic_nrql_alert_condition.foo will be updated in-place
  ~ resource "newrelic_nrql_alert_condition" "foo" {
      ~ account_id                     = ******* -> *******
        id                             = "*******:*******"
        name                           = "foo"
        # (16 unchanged attributes hidden)
        # (2 unchanged blocks hidden)
    }
Plan: 0 to add, 1 to change, 0 to destroy.
newrelic_nrql_alert_condition.foo: Modifying... [id=*******:*******]
╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to
│ newrelic_nrql_alert_condition.foo, provider
│ "provider[\"registry.terraform.io/newrelic/newrelic\"]" produced an
│ unexpected new value: Root object was present, but now absent.
│ 
│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.
╵
Error: Terraform exited with code 1.
Error: Process completed with exit code 1.

Expected Behavior

The resource should have been modified to use the new account ID.

Steps to Reproduce

  1. Apply a plan to a newrelic_nrql_alert_condition resource that modifies its account_id value.
@pranav-new-relic
Copy link
Member

Thank you for reporting this @RobertoGraham, appreciate the detail. We shall take a look at this sometime, based on our current priority queue.

@pranav-new-relic pranav-new-relic changed the title Cannot change account ID of newrelic_nrql_alert_condition resource. Resource newrelic_nrql_alert_condition: Cannot change account ID of newrelic_nrql_alert_condition resource. Jul 1, 2024
@pranav-new-relic pranav-new-relic changed the title Resource newrelic_nrql_alert_condition: Cannot change account ID of newrelic_nrql_alert_condition resource. Resource newrelic_nrql_alert_condition: Cannot change account ID of the resource. Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants