• /
  • EnglishEspañolFrançais日本語한국어Português
  • Inicia sesiónComenzar ahora

Migrate from drop rules to Pipeline cloud rules

Importante

As of May 21, 2025, new customers can no longer use NRQL drop rules. NRQL drop rules will be end-of-life on January 7, 2026.

Migrate to Pipeline cloud rules to continue managing your data dropping rules.

If you're managing your NRQL drop rules through Terraform using the newrelic_nrql_drop_rule resource, you'll need to migrate them to the newrelic_pipeline_cloud_rule resource. Although New Relic already migrated the underlying drop rules, Terraform maintains its own state file and only knows about the resources you explicitly configured. Since Terraform treats these as two completely different resource types, you'll need to import the Pipeline cloud rules into Terraform's state and remove the old drop rule resources.

Migration approaches

This guide covers two ways to migrate your NRQL drop rules to Pipeline cloud rules in Terraform:

  • Native Terraform commands: The standard Terraform workflow using terraform import, terraform plan, and terraform state rm commands.
  • New Relic CLI automation tools: New Relic provides CLI tools that automate the native Terraform workflow, available in two versions:
    • GitOps (CI/CD): For teams using CI/CD tools where Terraform state is not directly accessible from the workspace (typically stored in remote backends).
    • Local Terraform: For teams executing Terraform commands where they can directly read the Terraform state file, whether it's local or in a remote backend.

We recommend using New Relic's automation tools as they significantly reduce manual work and potential for errors. However, if you prefer complete control or have specific requirements, you can follow the native Terraform command approach.

Migrate with native Terraform commands

This section describes the standard Terraform workflow for migrating from newrelic_nrql_drop_rule resources to newrelic_pipeline_cloud_rule resources using native Terraform commands. All commands in this section should be run from your Terraform working directory where your drop rule configurations are located.

Prerequisites

  • Terraform or OpenTofu v1.5 or above: This version introduced the import block feature, which makes the migration process more efficient by eliminating the need to manually write resource configurations.
  • New Relic Terraform Provider v3.73.0 or above: This recommended version extends support for managing Pipeline cloud rules via Terraform using the newrelic_pipeline_cloud_rule resource and the pipeline_cloud_rule_entity_id attribute on newrelic_nrql_drop_rule resources (added in v3.68.0 released in September 2025) with important bug fixes to ensure a smooth migration process.

Migration steps

Get the Pipeline cloud rule IDs

Upgrade the New Relic Terraform Provider to v3.73.0 or greater in your Terraform working directory, then run terraform apply to update your existing newrelic_nrql_drop_rule resources. This operation updates the Terraform state by adding the pipeline_cloud_rule_entity_id attribute, which contains the ID of the corresponding Pipeline cloud rule that New Relic automatically created.

Note

For safer operations, use the -refresh-only flag to update state without making infrastructure changes, or use -target to limit the operation to specific drop rule resources.

Navigate to your Terraform working directory and run one of the following commands:

bash
$
# Apply to update state with pipeline_cloud_rule_entity_id
$
terraform apply
$
$
# Safer: use refresh-only to see changes without modifying infrastructure
$
terraform apply -refresh-only
$
$
# Targeted: limit operation to specific drop rule resources
$
terraform apply -refresh-only -target=newrelic_nrql_drop_rule.foo

After running one of the above commands, the pipeline_cloud_rule_entity_id will be available in your state for each drop rule. Keep the IDs handy for the next step.

# Example: Get the Pipeline cloud rule ID for a drop rule
newrelic_nrql_drop_rule.foo.pipeline_cloud_rule_entity_id

Import the Pipeline cloud rules into Terraform state

Create a new .tf file (for example, import_pipeline_rules.tf) in your Terraform working directory. In this file, add import blocks for each drop rule you want to migrate. Use the pipeline_cloud_rule_entity_id values from the previous step.

# import_pipeline_rules.tf
# Create import block using the pipeline_cloud_rule_entity_id from state
import {
to = newrelic_pipeline_cloud_rule.foo
# Reference the ID from the drop rule resource
id = newrelic_nrql_drop_rule.foo.pipeline_cloud_rule_entity_id
# Or use the actual value from your state
# id = "MzgwNjUyNnxOR0VQfFBJUEVMSU5FX0NMT1VEX1JVTEV8MDE5OTRjZjgtYmFmNy03MjU3LWE3M2MtZWY5OTkxYTQxMjgy"
}

Then run the Terraform commands from your Terraform working directory to generate configuration and import.

bash
$
# Generate Pipeline cloud rule configuration automatically
$
terraform plan -generate-config-out=generated_pipeline_rules.tf
$
$
# Apply to import the Pipeline cloud rules
$
terraform apply

Remove the old drop rule resources from Terraform state

After successfully importing the Pipeline cloud rules, you should remove all references to newrelic_nrql_drop_rule resources from your Terraform state using the terraform state rm command.

bash
$
terraform state rm newrelic_nrql_drop_rule.foo

This removes the drop rules from Terraform state without deleting them from New Relic.

Sugerencia

You can also use Terraform's removed block (available in Terraform v1.7 and above) to remove resources from state declaratively within your configuration files.

Clean up your Terraform configuration

After removing the drop rules from Terraform state, you must comment out all newrelic_nrql_drop_rule resource blocks from your Terraform configuration files and remove any auxiliary resources that depend on these drop rules.

Then verify the migration by running terraform plan:

bash
$
terraform plan

If the migration was successful, the output should show "No changes."

Migrate with New Relic's automation tools

To simplify the native Terraform migration workflow described above, New Relic provides CLI automation tools that handle the import and state management for you. These tools automate the same underlying Terraform operations (import, plan, apply, and state removal) but with significantly less manual work.

Prerequisites

  • Terraform or OpenTofu v1.5 or above: Required for the automated migration approaches.
  • New Relic Terraform Provider v3.73.0 or above: This recommended version extends support for managing Pipeline cloud rules via Terraform using the newrelic_pipeline_cloud_rule resource and the pipeline_cloud_rule_entity_id attribute on newrelic_nrql_drop_rule resources (added in v3.68.0 released in September 2025) with important bug fixes to ensure a smooth migration process.
  • New Relic CLI: Required to run the automated migration commands.
  • Environment Variables:
    • NEW_RELIC_API_KEY - Your New Relic User API key with appropriate permissions.
    • NEW_RELIC_ACCOUNT_ID - Your New Relic account ID where your drop rules are located.
    • NEW_RELIC_REGION (optional) - Set to 'US' or 'EU' based on your account region (defaults to 'US').

Choose your approach

Copyright © 2025 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.