1. Registry
  2. Packages
  3. Newrelic Provider
  4. API Docs
  5. NrqlMacro
Viewing docs for New Relic v5.80.8
published on Friday, Nov 6, 2026 by Pulumi
newrelic logo newrelic logo
Viewing docs for New Relic v5.80.8
published on Friday, Nov 6, 2026 by Pulumi

    Use this resource to create and manage a NRQL Macro.

    A NRQL Macro is a named expression fragment you can reuse across NRQL queries using the $macroName syntax. Macros belong to your organization and are available in every account within it.

    NOTE: Changes to a macro’s expression take effect immediately. Every dashboard widget, alert condition, and query that references this macro will use the new expression on its next execution.

    Example Usage

    Simple filter macro

    import * as pulumi from "@pulumi/pulumi";
    import * as newrelic from "@pulumi/newrelic";
    
    const productionFilter = new newrelic.NrqlMacro("production_filter", {
        name: "filterProductionTraffic",
        expression: "environment = 'production' AND appName NOT LIKE '%test%'",
    });
    
    import pulumi
    import pulumi_newrelic as newrelic
    
    production_filter = newrelic.NrqlMacro("production_filter",
        name="filterProductionTraffic",
        expression="environment = 'production' AND appName NOT LIKE '%test%'")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-newrelic/sdk/v5/go/newrelic"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := newrelic.NewNrqlMacro(ctx, "production_filter", &newrelic.NrqlMacroArgs{
    			Name:       pulumi.String("filterProductionTraffic"),
    			Expression: pulumi.String("environment = 'production' AND appName NOT LIKE '%test%'"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using NewRelic = Pulumi.NewRelic;
    
    return await Deployment.RunAsync(() => 
    {
        var productionFilter = new NewRelic.NrqlMacro("production_filter", new()
        {
            Name = "filterProductionTraffic",
            Expression = "environment = 'production' AND appName NOT LIKE '%test%'",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.newrelic.NrqlMacro;
    import com.pulumi.newrelic.NrqlMacroArgs;
    import java.util.ArrayList;
    import java.util.Arrays;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var productionFilter = new NrqlMacro("productionFilter", NrqlMacroArgs.builder()
                .name("filterProductionTraffic")
                .expression("environment = 'production' AND appName NOT LIKE '%test%'")
                .build());
    
        }
    }
    
    resources:
      productionFilter:
        type: newrelic:NrqlMacro
        name: production_filter
        properties:
          name: filterProductionTraffic
          expression: environment = 'production' AND appName NOT LIKE '%test%'
    
    terraform {
      required_providers {
        newrelic = {
          source = "pulumi/newrelic"
        }
      }
    }
    
    resource "newrelic_nrql_macro" "production_filter" {
      lifecycle {
        create_before_destroy = true
      }
      name       = "filterProductionTraffic"
      expression = "environment = 'production' AND appName NOT LIKE '%test%'"
    }
    

    Reference in a query:

    SELECT count(*) FROM Transaction WHERE $filterProductionTraffic TIMESERIES
    

    Macro with positional parameters

    Positional parameters use bare $1, $2, … tokens (not quoted). parameterCount must equal the number of distinct $N tokens in the expression.

    import * as pulumi from "@pulumi/pulumi";
    import * as newrelic from "@pulumi/newrelic";
    
    const statusRegionFilter = new newrelic.NrqlMacro("status_region_filter", {
        name: "filterStatusRegion",
        expression: "status = $1 AND region = $2",
        parameterCount: 2,
    });
    
    import pulumi
    import pulumi_newrelic as newrelic
    
    status_region_filter = newrelic.NrqlMacro("status_region_filter",
        name="filterStatusRegion",
        expression="status = $1 AND region = $2",
        parameter_count=2)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-newrelic/sdk/v5/go/newrelic"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := newrelic.NewNrqlMacro(ctx, "status_region_filter", &newrelic.NrqlMacroArgs{
    			Name:           pulumi.String("filterStatusRegion"),
    			Expression:     pulumi.String("status = $1 AND region = $2"),
    			ParameterCount: pulumi.Int(2),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using NewRelic = Pulumi.NewRelic;
    
    return await Deployment.RunAsync(() => 
    {
        var statusRegionFilter = new NewRelic.NrqlMacro("status_region_filter", new()
        {
            Name = "filterStatusRegion",
            Expression = "status = $1 AND region = $2",
            ParameterCount = 2,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.newrelic.NrqlMacro;
    import com.pulumi.newrelic.NrqlMacroArgs;
    import java.util.ArrayList;
    import java.util.Arrays;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var statusRegionFilter = new NrqlMacro("statusRegionFilter", NrqlMacroArgs.builder()
                .name("filterStatusRegion")
                .expression("status = $1 AND region = $2")
                .parameterCount(2)
                .build());
    
        }
    }
    
    resources:
      statusRegionFilter:
        type: newrelic:NrqlMacro
        name: status_region_filter
        properties:
          name: filterStatusRegion
          expression: status = $1 AND region = $2
          parameterCount: 2
    
    terraform {
      required_providers {
        newrelic = {
          source = "pulumi/newrelic"
        }
      }
    }
    
    resource "newrelic_nrql_macro" "status_region_filter" {
      lifecycle {
        create_before_destroy = true
      }
      name            = "filterStatusRegion"
      expression      = "status = $1 AND region = $2"
      parameter_count = 2
    }
    

    Using a macro in a dashboard widget

    import * as pulumi from "@pulumi/pulumi";
    import * as newrelic from "@pulumi/newrelic";
    
    const prodFilter = new newrelic.NrqlMacro("prod_filter", {
        name: "filterProduction",
        expression: "environment = 'production'",
    });
    const example = new newrelic.OneDashboard("example", {
        name: "Production Overview",
        pages: [{
            name: "Traffic",
            widgetLines: [{
                title: "Requests (Production)",
                row: 1,
                column: 1,
                width: 12,
                height: 3,
                nrqlQueries: [{
                    query: "SELECT count(*) FROM Transaction WHERE $filterProduction TIMESERIES",
                }],
            }],
        }],
    });
    
    import pulumi
    import pulumi_newrelic as newrelic
    
    prod_filter = newrelic.NrqlMacro("prod_filter",
        name="filterProduction",
        expression="environment = 'production'")
    example = newrelic.OneDashboard("example",
        name="Production Overview",
        pages=[{
            "name": "Traffic",
            "widget_lines": [{
                "title": "Requests (Production)",
                "row": 1,
                "column": 1,
                "width": 12,
                "height": 3,
                "nrql_queries": [{
                    "query": "SELECT count(*) FROM Transaction WHERE $filterProduction TIMESERIES",
                }],
            }],
        }])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-newrelic/sdk/v5/go/newrelic"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := newrelic.NewNrqlMacro(ctx, "prod_filter", &newrelic.NrqlMacroArgs{
    			Name:       pulumi.String("filterProduction"),
    			Expression: pulumi.String("environment = 'production'"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = newrelic.NewOneDashboard(ctx, "example", &newrelic.OneDashboardArgs{
    			Name: pulumi.String("Production Overview"),
    			Pages: newrelic.OneDashboardPageArray{
    				&newrelic.OneDashboardPageArgs{
    					Name: pulumi.String("Traffic"),
    					WidgetLines: newrelic.OneDashboardPageWidgetLineArray{
    						&newrelic.OneDashboardPageWidgetLineArgs{
    							Title:  pulumi.String("Requests (Production)"),
    							Row:    pulumi.Int(1),
    							Column: pulumi.Int(1),
    							Width:  pulumi.Int(12),
    							Height: pulumi.Int(3),
    							NrqlQueries: newrelic.OneDashboardPageWidgetLineNrqlQueryArray{
    								&newrelic.OneDashboardPageWidgetLineNrqlQueryArgs{
    									Query: pulumi.String("SELECT count(*) FROM Transaction WHERE $filterProduction TIMESERIES"),
    								},
    							},
    						},
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using NewRelic = Pulumi.NewRelic;
    
    return await Deployment.RunAsync(() => 
    {
        var prodFilter = new NewRelic.NrqlMacro("prod_filter", new()
        {
            Name = "filterProduction",
            Expression = "environment = 'production'",
        });
    
        var example = new NewRelic.OneDashboard("example", new()
        {
            Name = "Production Overview",
            Pages = new[]
            {
                new NewRelic.Inputs.OneDashboardPageArgs
                {
                    Name = "Traffic",
                    WidgetLines = new[]
                    {
                        new NewRelic.Inputs.OneDashboardPageWidgetLineArgs
                        {
                            Title = "Requests (Production)",
                            Row = 1,
                            Column = 1,
                            Width = 12,
                            Height = 3,
                            NrqlQueries = new[]
                            {
                                new NewRelic.Inputs.OneDashboardPageWidgetLineNrqlQueryArgs
                                {
                                    Query = "SELECT count(*) FROM Transaction WHERE $filterProduction TIMESERIES",
                                },
                            },
                        },
                    },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.newrelic.NrqlMacro;
    import com.pulumi.newrelic.NrqlMacroArgs;
    import com.pulumi.newrelic.OneDashboard;
    import com.pulumi.newrelic.OneDashboardArgs;
    import com.pulumi.newrelic.inputs.OneDashboardPageArgs;
    import com.pulumi.newrelic.inputs.OneDashboardPageWidgetLineArgs;
    import com.pulumi.newrelic.inputs.OneDashboardPageWidgetLineNrqlQueryArgs;
    import java.util.ArrayList;
    import java.util.Arrays;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var prodFilter = new NrqlMacro("prodFilter", NrqlMacroArgs.builder()
                .name("filterProduction")
                .expression("environment = 'production'")
                .build());
    
            var example = new OneDashboard("example", OneDashboardArgs.builder()
                .name("Production Overview")
                .pages(OneDashboardPageArgs.builder()
                    .name("Traffic")
                    .widgetLines(OneDashboardPageWidgetLineArgs.builder()
                        .title("Requests (Production)")
                        .row(1)
                        .column(1)
                        .width(12)
                        .height(3)
                        .nrqlQueries(OneDashboardPageWidgetLineNrqlQueryArgs.builder()
                            .query("SELECT count(*) FROM Transaction WHERE $filterProduction TIMESERIES")
                            .build())
                        .build())
                    .build())
                .build());
    
        }
    }
    
    resources:
      prodFilter:
        type: newrelic:NrqlMacro
        name: prod_filter
        properties:
          name: filterProduction
          expression: environment = 'production'
      example:
        type: newrelic:OneDashboard
        properties:
          name: Production Overview
          pages:
            - name: Traffic
              widgetLines:
                - title: Requests (Production)
                  row: 1
                  column: 1
                  width: 12
                  height: 3
                  nrqlQueries:
                    - query: SELECT count(*) FROM Transaction WHERE $filterProduction TIMESERIES
    
    terraform {
      required_providers {
        newrelic = {
          source = "pulumi/newrelic"
        }
      }
    }
    
    resource "newrelic_nrql_macro" "prod_filter" {
      lifecycle {
        create_before_destroy = true
      }
      name       = "filterProduction"
      expression = "environment = 'production'"
    }
    resource "newrelic_one_dashboard" "example" {
      lifecycle {
        create_before_destroy = true
      }
      name = "Production Overview"
      page {
        name = "Traffic"
        widget_line {
          title  = "Requests (Production)"
          row    = 1
          column = 1
          width  = 12
          height = 3
          nrql_query {
            query = "SELECT count(*) FROM Transaction WHERE $filterProduction TIMESERIES"
          }
        }
      }
    }
    

    Create NrqlMacro Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new NrqlMacro(name: string, args: NrqlMacroArgs, opts?: CustomResourceOptions);
    @overload
    def NrqlMacro(resource_name: str,
                  args: NrqlMacroArgs,
                  opts: Optional[ResourceOptions] = None)
    
    @overload
    def NrqlMacro(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  expression: Optional[str] = None,
                  name: Optional[str] = None,
                  parameter_count: Optional[int] = None)
    func NewNrqlMacro(ctx *Context, name string, args NrqlMacroArgs, opts ...ResourceOption) (*NrqlMacro, error)
    public NrqlMacro(string name, NrqlMacroArgs args, CustomResourceOptions? opts = null)
    public NrqlMacro(String name, NrqlMacroArgs args)
    public NrqlMacro(String name, NrqlMacroArgs args, CustomResourceOptions options)
    
    type: newrelic:NrqlMacro
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "newrelic_nrql_macro" "name" {
        # resource properties
    }

    Parameters

    name string
    The unique name of the resource.
    args NrqlMacroArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args NrqlMacroArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args NrqlMacroArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args NrqlMacroArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args NrqlMacroArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var nrqlMacroResource = new NewRelic.NrqlMacro("nrqlMacroResource", new()
    {
        Expression = "string",
        Name = "string",
        ParameterCount = 0,
    });
    
    example, err := newrelic.NewNrqlMacro(ctx, "nrqlMacroResource", &newrelic.NrqlMacroArgs{
    	Expression:     pulumi.String("string"),
    	Name:           pulumi.String("string"),
    	ParameterCount: pulumi.Int(0),
    })
    
    resource "newrelic_nrql_macro" "nrqlMacroResource" {
      lifecycle {
        create_before_destroy = true
      }
      expression      = "string"
      name            = "string"
      parameter_count = 0
    }
    
    var nrqlMacroResource = new NrqlMacro("nrqlMacroResource", NrqlMacroArgs.builder()
        .expression("string")
        .name("string")
        .parameterCount(0)
        .build());
    
    nrql_macro_resource = newrelic.NrqlMacro("nrqlMacroResource",
        expression="string",
        name="string",
        parameter_count=0)
    
    const nrqlMacroResource = new newrelic.NrqlMacro("nrqlMacroResource", {
        expression: "string",
        name: "string",
        parameterCount: 0,
    });
    
    type: newrelic:NrqlMacro
    properties:
        expression: string
        name: string
        parameterCount: 0
    

    NrqlMacro Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The NrqlMacro resource accepts the following input properties:

    Expression string
    The NRQL expression fragment this macro expands to. When using positional parameters ($1, $2, ...), parameterCount must also be set to the number of distinct tokens used.
    Name string
    A unique name for the macro within your organization. Used to reference it as $name in NRQL queries. Changing this value forces recreation of the resource.
    ParameterCount int
    The number of positional parameters ($1, $2, ...) the expression uses. Required when the expression contains positional parameters; defaults to 0 for expressions without them. Must equal the exact count of distinct $N tokens in the expression.
    Expression string
    The NRQL expression fragment this macro expands to. When using positional parameters ($1, $2, ...), parameterCount must also be set to the number of distinct tokens used.
    Name string
    A unique name for the macro within your organization. Used to reference it as $name in NRQL queries. Changing this value forces recreation of the resource.
    ParameterCount int
    The number of positional parameters ($1, $2, ...) the expression uses. Required when the expression contains positional parameters; defaults to 0 for expressions without them. Must equal the exact count of distinct $N tokens in the expression.
    expression string
    The NRQL expression fragment this macro expands to. When using positional parameters ($1, $2, ...), parameterCount must also be set to the number of distinct tokens used.
    name string
    A unique name for the macro within your organization. Used to reference it as $name in NRQL queries. Changing this value forces recreation of the resource.
    parameter_count number
    The number of positional parameters ($1, $2, ...) the expression uses. Required when the expression contains positional parameters; defaults to 0 for expressions without them. Must equal the exact count of distinct $N tokens in the expression.
    expression String
    The NRQL expression fragment this macro expands to. When using positional parameters ($1, $2, ...), parameterCount must also be set to the number of distinct tokens used.
    name String
    A unique name for the macro within your organization. Used to reference it as $name in NRQL queries. Changing this value forces recreation of the resource.
    parameterCount Integer
    The number of positional parameters ($1, $2, ...) the expression uses. Required when the expression contains positional parameters; defaults to 0 for expressions without them. Must equal the exact count of distinct $N tokens in the expression.
    expression string
    The NRQL expression fragment this macro expands to. When using positional parameters ($1, $2, ...), parameterCount must also be set to the number of distinct tokens used.
    name string
    A unique name for the macro within your organization. Used to reference it as $name in NRQL queries. Changing this value forces recreation of the resource.
    parameterCount number
    The number of positional parameters ($1, $2, ...) the expression uses. Required when the expression contains positional parameters; defaults to 0 for expressions without them. Must equal the exact count of distinct $N tokens in the expression.
    expression str
    The NRQL expression fragment this macro expands to. When using positional parameters ($1, $2, ...), parameterCount must also be set to the number of distinct tokens used.
    name str
    A unique name for the macro within your organization. Used to reference it as $name in NRQL queries. Changing this value forces recreation of the resource.
    parameter_count int
    The number of positional parameters ($1, $2, ...) the expression uses. Required when the expression contains positional parameters; defaults to 0 for expressions without them. Must equal the exact count of distinct $N tokens in the expression.
    expression String
    The NRQL expression fragment this macro expands to. When using positional parameters ($1, $2, ...), parameterCount must also be set to the number of distinct tokens used.
    name String
    A unique name for the macro within your organization. Used to reference it as $name in NRQL queries. Changing this value forces recreation of the resource.
    parameterCount Number
    The number of positional parameters ($1, $2, ...) the expression uses. Required when the expression contains positional parameters; defaults to 0 for expressions without them. Must equal the exact count of distinct $N tokens in the expression.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the NrqlMacro resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    OrganizationId string
    The GUID of the organization that owns this macro, resolved automatically from your provider credentials.
    Id string
    The provider-assigned unique ID for this managed resource.
    OrganizationId string
    The GUID of the organization that owns this macro, resolved automatically from your provider credentials.
    id string
    The provider-assigned unique ID for this managed resource.
    organization_id string
    The GUID of the organization that owns this macro, resolved automatically from your provider credentials.
    id String
    The provider-assigned unique ID for this managed resource.
    organizationId String
    The GUID of the organization that owns this macro, resolved automatically from your provider credentials.
    id string
    The provider-assigned unique ID for this managed resource.
    organizationId string
    The GUID of the organization that owns this macro, resolved automatically from your provider credentials.
    id str
    The provider-assigned unique ID for this managed resource.
    organization_id str
    The GUID of the organization that owns this macro, resolved automatically from your provider credentials.
    id String
    The provider-assigned unique ID for this managed resource.
    organizationId String
    The GUID of the organization that owns this macro, resolved automatically from your provider credentials.

    Look up Existing NrqlMacro Resource

    Get an existing NrqlMacro resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: NrqlMacroState, opts?: CustomResourceOptions): NrqlMacro
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            expression: Optional[str] = None,
            name: Optional[str] = None,
            organization_id: Optional[str] = None,
            parameter_count: Optional[int] = None) -> NrqlMacro
    func GetNrqlMacro(ctx *Context, name string, id IDInput, state *NrqlMacroState, opts ...ResourceOption) (*NrqlMacro, error)
    public static NrqlMacro Get(string name, Input<string> id, NrqlMacroState? state, CustomResourceOptions? opts = null)
    public static NrqlMacro get(String name, Output<String> id, NrqlMacroState state, CustomResourceOptions options)
    resources:  _:    type: newrelic:NrqlMacro    get:      id: ${id}
    import {
      to = newrelic_nrql_macro.example
      id = "${id}"
    }
    
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Expression string
    The NRQL expression fragment this macro expands to. When using positional parameters ($1, $2, ...), parameterCount must also be set to the number of distinct tokens used.
    Name string
    A unique name for the macro within your organization. Used to reference it as $name in NRQL queries. Changing this value forces recreation of the resource.
    OrganizationId string
    The GUID of the organization that owns this macro, resolved automatically from your provider credentials.
    ParameterCount int
    The number of positional parameters ($1, $2, ...) the expression uses. Required when the expression contains positional parameters; defaults to 0 for expressions without them. Must equal the exact count of distinct $N tokens in the expression.
    Expression string
    The NRQL expression fragment this macro expands to. When using positional parameters ($1, $2, ...), parameterCount must also be set to the number of distinct tokens used.
    Name string
    A unique name for the macro within your organization. Used to reference it as $name in NRQL queries. Changing this value forces recreation of the resource.
    OrganizationId string
    The GUID of the organization that owns this macro, resolved automatically from your provider credentials.
    ParameterCount int
    The number of positional parameters ($1, $2, ...) the expression uses. Required when the expression contains positional parameters; defaults to 0 for expressions without them. Must equal the exact count of distinct $N tokens in the expression.
    expression string
    The NRQL expression fragment this macro expands to. When using positional parameters ($1, $2, ...), parameterCount must also be set to the number of distinct tokens used.
    name string
    A unique name for the macro within your organization. Used to reference it as $name in NRQL queries. Changing this value forces recreation of the resource.
    organization_id string
    The GUID of the organization that owns this macro, resolved automatically from your provider credentials.
    parameter_count number
    The number of positional parameters ($1, $2, ...) the expression uses. Required when the expression contains positional parameters; defaults to 0 for expressions without them. Must equal the exact count of distinct $N tokens in the expression.
    expression String
    The NRQL expression fragment this macro expands to. When using positional parameters ($1, $2, ...), parameterCount must also be set to the number of distinct tokens used.
    name String
    A unique name for the macro within your organization. Used to reference it as $name in NRQL queries. Changing this value forces recreation of the resource.
    organizationId String
    The GUID of the organization that owns this macro, resolved automatically from your provider credentials.
    parameterCount Integer
    The number of positional parameters ($1, $2, ...) the expression uses. Required when the expression contains positional parameters; defaults to 0 for expressions without them. Must equal the exact count of distinct $N tokens in the expression.
    expression string
    The NRQL expression fragment this macro expands to. When using positional parameters ($1, $2, ...), parameterCount must also be set to the number of distinct tokens used.
    name string
    A unique name for the macro within your organization. Used to reference it as $name in NRQL queries. Changing this value forces recreation of the resource.
    organizationId string
    The GUID of the organization that owns this macro, resolved automatically from your provider credentials.
    parameterCount number
    The number of positional parameters ($1, $2, ...) the expression uses. Required when the expression contains positional parameters; defaults to 0 for expressions without them. Must equal the exact count of distinct $N tokens in the expression.
    expression str
    The NRQL expression fragment this macro expands to. When using positional parameters ($1, $2, ...), parameterCount must also be set to the number of distinct tokens used.
    name str
    A unique name for the macro within your organization. Used to reference it as $name in NRQL queries. Changing this value forces recreation of the resource.
    organization_id str
    The GUID of the organization that owns this macro, resolved automatically from your provider credentials.
    parameter_count int
    The number of positional parameters ($1, $2, ...) the expression uses. Required when the expression contains positional parameters; defaults to 0 for expressions without them. Must equal the exact count of distinct $N tokens in the expression.
    expression String
    The NRQL expression fragment this macro expands to. When using positional parameters ($1, $2, ...), parameterCount must also be set to the number of distinct tokens used.
    name String
    A unique name for the macro within your organization. Used to reference it as $name in NRQL queries. Changing this value forces recreation of the resource.
    organizationId String
    The GUID of the organization that owns this macro, resolved automatically from your provider credentials.
    parameterCount Number
    The number of positional parameters ($1, $2, ...) the expression uses. Required when the expression contains positional parameters; defaults to 0 for expressions without them. Must equal the exact count of distinct $N tokens in the expression.

    Import

    NRQL Macros can be imported using the entity GUID:

    $ pulumi import newrelic:index/nrqlMacro:NrqlMacro production_filter <entity-guid>
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    New Relic pulumi/pulumi-newrelic
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the newrelic Terraform Provider.
    newrelic logo newrelic logo
    Viewing docs for New Relic v5.80.8
    published on Friday, Nov 6, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial