Resource: awsCloudwatchCompositeAlarm
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 Terraform will unsuccessfully attempt to destroy alarms before updating the rule. Consider using dependsOn
, references to alarm names, and two-stage updates.
Example Usage
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.cloudwatchCompositeAlarm.CloudwatchCompositeAlarm(this, "example", {
alarmActions: "${aws_sns_topic.example.arn}",
alarmDescription: "This is a composite alarm!",
alarmName: "example-composite-alarm",
alarmRule:
"ALARM(${aws_cloudwatch_metric_alarm.alpha.alarm_name}) OR\nALARM(${aws_cloudwatch_metric_alarm.bravo.alarm_name})\n",
okActions: "${aws_sns_topic.example.arn}",
});
Argument Reference
actionsEnabled
- (Optional, Forces new resource) Indicates whether actions should be executed during any changes to the alarm state of the composite alarm. Defaults totrue
.alarmActions
- (Optional) The set of actions to execute when this alarm transitions to thealarm
state from any other state. Each action is specified as an ARN. Up to 5 actions are allowed.alarmDescription
- (Optional) The description for the composite alarm.alarmName
- (Required) The name for the composite alarm. This name must be unique within the region.alarmRule
- (Required) 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.insufficientDataActions
- (Optional) The set of actions to execute when this alarm transitions to theINSUFFICIENT_DATA
state from any other state. Each action is specified as an ARN. Up to 5 actions are allowed.okActions
- (Optional) The set of actions to execute when this alarm transitions to anok
state from any other state. Each action is specified as an ARN. Up to 5 actions are allowed.tags
- (Optional) A map of tags to associate with the alarm. Up to 50 tags are allowed. If configured with a providerdefaultTags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Attributes Reference
In addition to all arguments above, the following attributes are exported:
arn
- The ARN of the composite alarm.id
- The ID of the composite alarm resource, which is equivalent to itsalarmName
.tagsAll
- A map of tags assigned to the resource, including those inherited from the providerdefaultTags
configuration block.
Import
Use the alarmName
to import a CloudWatch Composite Alarm. For example: