CompositeAlarm class

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 dependsOn, 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", {
    actionsSuppressor: {
        alarm: "suppressor-alarm",
        extensionPeriod: 10,
        waitPeriod: 20,
    },
    alarmDescription: "This is a composite alarm!",
    alarmName: "example-composite-alarm",
    alarmActions: exampleAwsSnsTopic.arn,
    okActions: exampleAwsSnsTopic.arn,
    alarmRule: `ALARM(${alpha.alarmName}) OR
ALARM(${bravo.alarmName})
`,
});
import pulumi
import pulumi_aws as aws

example = aws.cloudwatch.CompositeAlarm("example",
    actions_suppressor={
        "alarm": "suppressor-alarm",
        "extension_period": 10,
        "wait_period": 20,
    },
    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"]})
""")
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()
    {
        ActionsSuppressor = new Aws.CloudWatch.Inputs.CompositeAlarmActionsSuppressorArgs
        {
            Alarm = "suppressor-alarm",
            ExtensionPeriod = 10,
            WaitPeriod = 20,
        },
        AlarmDescription = "This is a composite alarm!",
        AlarmName = "example-composite-alarm",
        AlarmActions = exampleAwsSnsTopic.Arn,
        OkActions = exampleAwsSnsTopic.Arn,
        AlarmRule = @$"ALARM({alpha.AlarmName}) OR
ALARM({bravo.AlarmName})
",
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/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{
			ActionsSuppressor: &cloudwatch.CompositeAlarmActionsSuppressorArgs{
				Alarm:           pulumi.String("suppressor-alarm"),
				ExtensionPeriod: pulumi.Int(10),
				WaitPeriod:      pulumi.Int(20),
			},
			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),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_cloudwatch_compositealarm" "example" {
  actions_suppressor = {
    alarm            = "suppressor-alarm"
    extension_period = 10
    wait_period      = 20
  }
  alarm_description = "This is a composite alarm!"
  alarm_name        = "example-composite-alarm"
  alarm_actions     = exampleAwsSnsTopic.arn
  ok_actions        = exampleAwsSnsTopic.arn
  alarm_rule        ="ALARM(${alpha.alarmName}) OR
ALARM(${bravo.alarmName})
"
}
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.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 example = new CompositeAlarm("example", CompositeAlarmArgs.builder()
            .actionsSuppressor(CompositeAlarmActionsSuppressorArgs.builder()
                .alarm("suppressor-alarm")
                .extensionPeriod(10)
                .waitPeriod(20)
                .build())
            .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()))
            .build());

    }
}
resources:
  example:
    type: aws:cloudwatch:CompositeAlarm
    properties:
      actionsSuppressor:
        alarm: suppressor-alarm
        extensionPeriod: 10
        waitPeriod: 20
      alarmDescription: This is a composite alarm!
      alarmName: example-composite-alarm
      alarmActions: ${exampleAwsSnsTopic.arn}
      okActions: ${exampleAwsSnsTopic.arn}
      alarmRule: |
        ALARM(${alpha.alarmName}) OR
        ALARM(${bravo.alarmName})

Import

Identity Schema

Required

  • alarmName (String) Name of the composite alarm.

Optional

  • accountId (String) AWS Account where this resource is managed.
  • region (String) Region where this resource is managed.

Using pulumi import, import Composite Alarms using alarmName. For example:

$ pulumi import aws:cloudwatch/compositeAlarm:CompositeAlarm example example-alarm

Constructors

CompositeAlarm(String name, {CompositeAlarmArgs? args, CustomResourceOptions? options})
Creates a new CompositeAlarm. name The Pulumi resource name. args Arguments used to configure this CompositeAlarm. The set of arguments for CompositeAlarm. options Resource options controlling this resource's behavior.
CompositeAlarm.reference(String urn)
Creates a typed reference to an existing CompositeAlarm resource.

Properties

actionsEnabled ↔ Output<bool?>
Indicates whether actions should be executed during any changes to the alarm state of the composite alarm. Defaults to true.
latefinal
actionsSuppressor ↔ Output<CompositeAlarmActionsSuppressor?>
Actions will be suppressed if the suppressor alarm is in the ALARM state.
latefinal
alarmActions ↔ Output<List<String>?>
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.
latefinal
alarmDescription ↔ Output<String?>
The description for the composite alarm.
latefinal
alarmName ↔ Output<String>
The name for the composite alarm. This name must be unique within the region.
latefinal
alarmRule ↔ Output<String>
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.
latefinal
arn ↔ Output<String>
The ARN of the composite alarm.
latefinal
childResources Set<Resource>
finalinherited
completionSources Map<String, IOutputCompletionSource>
latefinalinherited
hashCode int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
insufficientDataActions ↔ Output<List<String>?>
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.
latefinal
isCustom bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference bool
Whether this instance represents a resource value returned over RPC.
finalinherited
okActions ↔ Output<List<String>?>
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.
latefinal
region ↔ Output<String>
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
resourceTransforms List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tags ↔ Output<Map<String, String>?>
A map of tags to associate with the alarm. Up to 50 tags are allowed. .If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
latefinal
tagsAll ↔ Output<Map<String, String>>
A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
latefinal
transformations List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() String
Returns this resource's logical name.
inherited
getResourceType() String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {CompositeAlarmState? state, CustomResourceOptions? options}) CompositeAlarm
Gets an existing CompositeAlarm resource's state with the given name and id.