CompositeAlarmArgs

data class CompositeAlarmArgs(val actionsEnabled: Output<Boolean>? = null, val actionsSuppressor: Output<CompositeAlarmActionsSuppressorArgs>? = null, val alarmActions: Output<List<String>>? = null, val alarmDescription: Output<String>? = null, val alarmName: Output<String>? = null, val alarmRule: Output<String>? = null, val insufficientDataActions: Output<List<String>>? = null, val okActions: Output<List<String>>? = null, val tags: Output<Map<String, String>>? = null) : ConvertibleToJava<CompositeAlarmArgs>

Provides a CloudWatch Composite Alarm resource.

NOTE: An alarm (composite or metric) cannot be destroyed when there are other composite alarms depending on it. This can lead to a cyclical dependency on update, as the provider will unsuccessfully attempt to destroy alarms before updating the rule. Consider using depends_on, references to alarm names, and two-stage updates.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.cloudwatch.CompositeAlarm("example", {
alarmDescription: "This is a composite alarm!",
alarmName: "example-composite-alarm",
alarmActions: exampleAwsSnsTopic.arn,
okActions: exampleAwsSnsTopic.arn,
alarmRule: `ALARM(${alpha.alarmName}) OR
ALARM(${bravo.alarmName})
`,
actionsSuppressor: {
alarm: "suppressor-alarm",
extensionPeriod: 10,
waitPeriod: 20,
},
});
import pulumi
import pulumi_aws as aws
example = aws.cloudwatch.CompositeAlarm("example",
alarm_description="This is a composite alarm!",
alarm_name="example-composite-alarm",
alarm_actions=example_aws_sns_topic["arn"],
ok_actions=example_aws_sns_topic["arn"],
alarm_rule=f"""ALARM({alpha["alarmName"]}) OR
ALARM({bravo["alarmName"]})
""",
actions_suppressor={
"alarm": "suppressor-alarm",
"extension_period": 10,
"wait_period": 20,
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.CloudWatch.CompositeAlarm("example", new()
{
AlarmDescription = "This is a composite alarm!",
AlarmName = "example-composite-alarm",
AlarmActions = exampleAwsSnsTopic.Arn,
OkActions = exampleAwsSnsTopic.Arn,
AlarmRule = @$"ALARM({alpha.AlarmName}) OR
ALARM({bravo.AlarmName})
",
ActionsSuppressor = new Aws.CloudWatch.Inputs.CompositeAlarmActionsSuppressorArgs
{
Alarm = "suppressor-alarm",
ExtensionPeriod = 10,
WaitPeriod = 20,
},
});
});
package main
import (
"fmt"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := cloudwatch.NewCompositeAlarm(ctx, "example", &cloudwatch.CompositeAlarmArgs{
AlarmDescription: pulumi.String("This is a composite alarm!"),
AlarmName: pulumi.String("example-composite-alarm"),
AlarmActions: pulumi.Any(exampleAwsSnsTopic.Arn),
OkActions: pulumi.Any(exampleAwsSnsTopic.Arn),
AlarmRule: pulumi.Sprintf("ALARM(%v) OR\nALARM(%v)\n", alpha.AlarmName, bravo.AlarmName),
ActionsSuppressor: &cloudwatch.CompositeAlarmActionsSuppressorArgs{
Alarm: pulumi.String("suppressor-alarm"),
ExtensionPeriod: pulumi.Int(10),
WaitPeriod: pulumi.Int(20),
},
})
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.aws.cloudwatch.CompositeAlarm;
import com.pulumi.aws.cloudwatch.CompositeAlarmArgs;
import com.pulumi.aws.cloudwatch.inputs.CompositeAlarmActionsSuppressorArgs;
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) {
var example = new CompositeAlarm("example", CompositeAlarmArgs.builder()
.alarmDescription("This is a composite alarm!")
.alarmName("example-composite-alarm")
.alarmActions(exampleAwsSnsTopic.arn())
.okActions(exampleAwsSnsTopic.arn())
.alarmRule("""
ALARM(%s) OR
ALARM(%s)
", alpha.alarmName(),bravo.alarmName()))
.actionsSuppressor(CompositeAlarmActionsSuppressorArgs.builder()
.alarm("suppressor-alarm")
.extensionPeriod(10)
.waitPeriod(20)
.build())
.build());
}
}
resources:
example:
type: aws:cloudwatch:CompositeAlarm
properties:
alarmDescription: This is a composite alarm!
alarmName: example-composite-alarm
alarmActions: ${exampleAwsSnsTopic.arn}
okActions: ${exampleAwsSnsTopic.arn}
alarmRule: |
ALARM(${alpha.alarmName}) OR
ALARM(${bravo.alarmName})
actionsSuppressor:
alarm: suppressor-alarm
extensionPeriod: 10
waitPeriod: 20

Import

Using pulumi import, import a CloudWatch Composite Alarm using the alarm_name. For example:

$ pulumi import aws:cloudwatch/compositeAlarm:CompositeAlarm test my-alarm

Constructors

Link copied to clipboard
constructor(actionsEnabled: Output<Boolean>? = null, actionsSuppressor: Output<CompositeAlarmActionsSuppressorArgs>? = null, alarmActions: Output<List<String>>? = null, alarmDescription: Output<String>? = null, alarmName: Output<String>? = null, alarmRule: Output<String>? = null, insufficientDataActions: Output<List<String>>? = null, okActions: Output<List<String>>? = null, tags: Output<Map<String, String>>? = null)

Properties

Link copied to clipboard
val actionsEnabled: Output<Boolean>? = null

Indicates whether actions should be executed during any changes to the alarm state of the composite alarm. Defaults to true.

Link copied to clipboard

Actions will be suppressed if the suppressor alarm is in the ALARM state.

Link copied to clipboard
val alarmActions: Output<List<String>>? = null

The set of actions to execute when this alarm transitions to the ALARM state from any other state. Each action is specified as an ARN. Up to 5 actions are allowed.

Link copied to clipboard
val alarmDescription: Output<String>? = null

The description for the composite alarm.

Link copied to clipboard
val alarmName: Output<String>? = null

The name for the composite alarm. This name must be unique within the region.

Link copied to clipboard
val alarmRule: Output<String>? = null

An expression that specifies which other alarms are to be evaluated to determine this composite alarm's state. For syntax, see Creating a Composite Alarm. The maximum length is 10240 characters.

Link copied to clipboard
val insufficientDataActions: Output<List<String>>? = null

The set of actions to execute when this alarm transitions to the INSUFFICIENT_DATA state from any other state. Each action is specified as an ARN. Up to 5 actions are allowed.

Link copied to clipboard
val okActions: Output<List<String>>? = null

The set of actions to execute when this alarm transitions to an OK state from any other state. Each action is specified as an ARN. Up to 5 actions are allowed.

Link copied to clipboard
val tags: Output<Map<String, String>>? = null

A map of tags to associate with the alarm. Up to 50 tags are allowed. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Functions

Link copied to clipboard
open override fun toJava(): CompositeAlarmArgs