1. Packages
  2. Packages
  3. Newrelic Provider
  4. API Docs
  5. synthetics
  6. AlertCondition
Viewing docs for New Relic v4.20.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi
newrelic logo
Viewing docs for New Relic v4.20.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi

    Use this resource to create and manage synthetics alert conditions in New Relic.

    NOTE: The newrelic.NrqlAlertCondition resource is preferred for configuring alerts conditions. In most cases feature parity can be achieved with a NRQL query. Other condition types may be deprecated in the future and receive fewer product updates.

    Example Usage

    using System.Collections.Generic;
    using Pulumi;
    using NewRelic = Pulumi.NewRelic;
    
    return await Deployment.RunAsync(() => 
    {
        var fooMonitor = NewRelic.Synthetics.GetMonitor.Invoke(new()
        {
            Name = "foo",
        });
    
        var fooAlertCondition = new NewRelic.Synthetics.AlertCondition("fooAlertCondition", new()
        {
            PolicyId = newrelic_alert_policy.Foo.Id,
            MonitorId = fooMonitor.Apply(getMonitorResult => getMonitorResult.Id),
            RunbookUrl = "https://www.example.com",
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-newrelic/sdk/v4/go/newrelic/synthetics"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		fooMonitor, err := synthetics.LookupMonitor(ctx, &synthetics.LookupMonitorArgs{
    			Name: "foo",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = synthetics.NewAlertCondition(ctx, "fooAlertCondition", &synthetics.AlertConditionArgs{
    			PolicyId:   pulumi.Any(newrelic_alert_policy.Foo.Id),
    			MonitorId:  pulumi.String(fooMonitor.Id),
    			RunbookUrl: pulumi.String("https://www.example.com"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.newrelic.synthetics.SyntheticsFunctions;
    import com.pulumi.newrelic.synthetics.inputs.GetMonitorArgs;
    import com.pulumi.newrelic.synthetics.AlertCondition;
    import com.pulumi.newrelic.synthetics.AlertConditionArgs;
    import java.util.List;
    import java.util.ArrayList;
    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) {
            final var fooMonitor = SyntheticsFunctions.getMonitor(GetMonitorArgs.builder()
                .name("foo")
                .build());
    
            var fooAlertCondition = new AlertCondition("fooAlertCondition", AlertConditionArgs.builder()        
                .policyId(newrelic_alert_policy.foo().id())
                .monitorId(fooMonitor.applyValue(getMonitorResult -> getMonitorResult.id()))
                .runbookUrl("https://www.example.com")
                .build());
    
        }
    }
    
    import * as pulumi from "@pulumi/pulumi";
    import * as newrelic from "@pulumi/newrelic";
    
    const fooMonitor = newrelic.synthetics.getMonitor({
        name: "foo",
    });
    const fooAlertCondition = new newrelic.synthetics.AlertCondition("fooAlertCondition", {
        policyId: newrelic_alert_policy.foo.id,
        monitorId: fooMonitor.then(fooMonitor => fooMonitor.id),
        runbookUrl: "https://www.example.com",
    });
    
    import pulumi
    import pulumi_newrelic as newrelic
    
    foo_monitor = newrelic.synthetics.get_monitor(name="foo")
    foo_alert_condition = newrelic.synthetics.AlertCondition("fooAlertCondition",
        policy_id=newrelic_alert_policy["foo"]["id"],
        monitor_id=foo_monitor.id,
        runbook_url="https://www.example.com")
    
    resources:
      fooAlertCondition:
        type: newrelic:synthetics:AlertCondition
        properties:
          policyId: ${newrelic_alert_policy.foo.id}
          monitorId: ${fooMonitor.id}
          runbookUrl: https://www.example.com
    variables:
      fooMonitor:
        Fn::Invoke:
          Function: newrelic:synthetics:getMonitor
          Arguments:
            name: foo
    

    Create AlertCondition Resource

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

    Constructor syntax

    new AlertCondition(name: string, args: AlertConditionArgs, opts?: CustomResourceOptions);
    @overload
    def AlertCondition(resource_name: str,
                       args: AlertConditionArgs,
                       opts: Optional[ResourceOptions] = None)
    
    @overload
    def AlertCondition(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       monitor_id: Optional[str] = None,
                       policy_id: Optional[int] = None,
                       enabled: Optional[bool] = None,
                       name: Optional[str] = None,
                       runbook_url: Optional[str] = None)
    func NewAlertCondition(ctx *Context, name string, args AlertConditionArgs, opts ...ResourceOption) (*AlertCondition, error)
    public AlertCondition(string name, AlertConditionArgs args, CustomResourceOptions? opts = null)
    public AlertCondition(String name, AlertConditionArgs args)
    public AlertCondition(String name, AlertConditionArgs args, CustomResourceOptions options)
    
    type: newrelic:synthetics:AlertCondition
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args AlertConditionArgs
    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 AlertConditionArgs
    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 AlertConditionArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args AlertConditionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args AlertConditionArgs
    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 examplealertConditionResourceResourceFromSyntheticsalertCondition = new NewRelic.Synthetics.AlertCondition("examplealertConditionResourceResourceFromSyntheticsalertCondition", new()
    {
        MonitorId = "string",
        PolicyId = 0,
        Enabled = false,
        Name = "string",
        RunbookUrl = "string",
    });
    
    example, err := synthetics.NewAlertCondition(ctx, "examplealertConditionResourceResourceFromSyntheticsalertCondition", &synthetics.AlertConditionArgs{
    	MonitorId:  pulumi.String("string"),
    	PolicyId:   pulumi.Int(0),
    	Enabled:    pulumi.Bool(false),
    	Name:       pulumi.String("string"),
    	RunbookUrl: pulumi.String("string"),
    })
    
    var examplealertConditionResourceResourceFromSyntheticsalertCondition = new com.pulumi.newrelic.synthetics.AlertCondition("examplealertConditionResourceResourceFromSyntheticsalertCondition", com.pulumi.newrelic.synthetics.AlertConditionArgs.builder()
        .monitorId("string")
        .policyId(0)
        .enabled(false)
        .name("string")
        .runbookUrl("string")
        .build());
    
    examplealert_condition_resource_resource_from_syntheticsalert_condition = newrelic.synthetics.AlertCondition("examplealertConditionResourceResourceFromSyntheticsalertCondition",
        monitor_id="string",
        policy_id=0,
        enabled=False,
        name="string",
        runbook_url="string")
    
    const examplealertConditionResourceResourceFromSyntheticsalertCondition = new newrelic.synthetics.AlertCondition("examplealertConditionResourceResourceFromSyntheticsalertCondition", {
        monitorId: "string",
        policyId: 0,
        enabled: false,
        name: "string",
        runbookUrl: "string",
    });
    
    type: newrelic:synthetics:AlertCondition
    properties:
        enabled: false
        monitorId: string
        name: string
        policyId: 0
        runbookUrl: string
    

    AlertCondition 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 AlertCondition resource accepts the following input properties:

    MonitorId string
    The ID of the Synthetics monitor to be referenced in the alert condition.
    PolicyId int
    The ID of the policy where this condition should be used.
    Enabled bool
    Set whether to enable the alert condition. Defaults to true.
    Name string
    The title of this condition.
    RunbookUrl string
    Runbook URL to display in notifications.
    MonitorId string
    The ID of the Synthetics monitor to be referenced in the alert condition.
    PolicyId int
    The ID of the policy where this condition should be used.
    Enabled bool
    Set whether to enable the alert condition. Defaults to true.
    Name string
    The title of this condition.
    RunbookUrl string
    Runbook URL to display in notifications.
    monitorId String
    The ID of the Synthetics monitor to be referenced in the alert condition.
    policyId Integer
    The ID of the policy where this condition should be used.
    enabled Boolean
    Set whether to enable the alert condition. Defaults to true.
    name String
    The title of this condition.
    runbookUrl String
    Runbook URL to display in notifications.
    monitorId string
    The ID of the Synthetics monitor to be referenced in the alert condition.
    policyId number
    The ID of the policy where this condition should be used.
    enabled boolean
    Set whether to enable the alert condition. Defaults to true.
    name string
    The title of this condition.
    runbookUrl string
    Runbook URL to display in notifications.
    monitor_id str
    The ID of the Synthetics monitor to be referenced in the alert condition.
    policy_id int
    The ID of the policy where this condition should be used.
    enabled bool
    Set whether to enable the alert condition. Defaults to true.
    name str
    The title of this condition.
    runbook_url str
    Runbook URL to display in notifications.
    monitorId String
    The ID of the Synthetics monitor to be referenced in the alert condition.
    policyId Number
    The ID of the policy where this condition should be used.
    enabled Boolean
    Set whether to enable the alert condition. Defaults to true.
    name String
    The title of this condition.
    runbookUrl String
    Runbook URL to display in notifications.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing AlertCondition Resource

    Get an existing AlertCondition 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?: AlertConditionState, opts?: CustomResourceOptions): AlertCondition
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            enabled: Optional[bool] = None,
            monitor_id: Optional[str] = None,
            name: Optional[str] = None,
            policy_id: Optional[int] = None,
            runbook_url: Optional[str] = None) -> AlertCondition
    func GetAlertCondition(ctx *Context, name string, id IDInput, state *AlertConditionState, opts ...ResourceOption) (*AlertCondition, error)
    public static AlertCondition Get(string name, Input<string> id, AlertConditionState? state, CustomResourceOptions? opts = null)
    public static AlertCondition get(String name, Output<String> id, AlertConditionState state, CustomResourceOptions options)
    resources:  _:    type: newrelic:synthetics:AlertCondition    get:      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:
    Enabled bool
    Set whether to enable the alert condition. Defaults to true.
    MonitorId string
    The ID of the Synthetics monitor to be referenced in the alert condition.
    Name string
    The title of this condition.
    PolicyId int
    The ID of the policy where this condition should be used.
    RunbookUrl string
    Runbook URL to display in notifications.
    Enabled bool
    Set whether to enable the alert condition. Defaults to true.
    MonitorId string
    The ID of the Synthetics monitor to be referenced in the alert condition.
    Name string
    The title of this condition.
    PolicyId int
    The ID of the policy where this condition should be used.
    RunbookUrl string
    Runbook URL to display in notifications.
    enabled Boolean
    Set whether to enable the alert condition. Defaults to true.
    monitorId String
    The ID of the Synthetics monitor to be referenced in the alert condition.
    name String
    The title of this condition.
    policyId Integer
    The ID of the policy where this condition should be used.
    runbookUrl String
    Runbook URL to display in notifications.
    enabled boolean
    Set whether to enable the alert condition. Defaults to true.
    monitorId string
    The ID of the Synthetics monitor to be referenced in the alert condition.
    name string
    The title of this condition.
    policyId number
    The ID of the policy where this condition should be used.
    runbookUrl string
    Runbook URL to display in notifications.
    enabled bool
    Set whether to enable the alert condition. Defaults to true.
    monitor_id str
    The ID of the Synthetics monitor to be referenced in the alert condition.
    name str
    The title of this condition.
    policy_id int
    The ID of the policy where this condition should be used.
    runbook_url str
    Runbook URL to display in notifications.
    enabled Boolean
    Set whether to enable the alert condition. Defaults to true.
    monitorId String
    The ID of the Synthetics monitor to be referenced in the alert condition.
    name String
    The title of this condition.
    policyId Number
    The ID of the policy where this condition should be used.
    runbookUrl String
    Runbook URL to display in notifications.

    Import

    Synthetics alert conditions can be imported using a composite ID of <policy_id>:<condition_id>, e.g.

     $ pulumi import newrelic:synthetics/alertCondition:AlertCondition main 12345:67890
    

    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
    Viewing docs for New Relic v4.20.0 (Older version)
    published on Monday, Mar 9, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.