Skip to content

(aws-cloudwatch): AlarmRule.anyOf returns invalid alarm rule #14387

@andsok75

Description

@andsok75

AlarmRule.anyOf(...alarms) where alarms is empty yields "()" which is not a valid alarm rule.

Reproduction Steps

const alarms: Array<cw.Alarm> = [];
new cw.CompositeAlarm(this, 'CompositeAlarm', {
  compositeAlarmName: "CompositeAlarm",
  alarmRule: cw.AlarmRule.anyOf(...alarms),
});

Adding the above to the basic example (generated by cdk init) and running cdk synth

What did you expect to happen?

I expected a valid alarm rule to be created even for cases when the list of alarms passed to anyOf is empty.

What actually happened?

Running cdk synth and checking the generated template shows the AlarmRule as () which is not valid

CompositeAlarmF4C3D082:
Type: AWS::CloudWatch::CompositeAlarm
Properties:
AlarmName: CompositeAlarm
AlarmRule: ()

Environment

  • CDK CLI Version : 1.72.0
  • Framework Version:
  • Node.js Version: v11.13.0
  • OS :
  • Language (Version):

Other


This is 🐛 Bug Report

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-cloudwatchRelated to Amazon CloudWatchclosed-for-stalenessThis issue was automatically closed because it hadn't received any attention in a while.effort/smallSmall work item – less than a day of effort

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions