aws-cloudwatch: Imported composite alarm ARN incorrect #24594
Labels
@aws-cdk/aws-cloudwatch
Related to Amazon CloudWatch
bug
This issue is a bug.
effort/small
Small work item – less than a day of effort
p1
Describe the bug
It seems that the ARN used for CompositeAlarms is incorrectly generated when using
CompositeAlarm.fromCompositeAlarmName
. The resulting ARN has/
as separator where as the actual alarm has:
.The whole thing is a bit wonky too:
Alarm
andCompositeAlarm
instances are equivalent, yet in CDK they are differentAlarm.fromAlarmName
, even thoughCompositeAlarm.fromCompositeAlarmName
existsIAlarm
anyway, so the distinction betweenAlarm
andCompositeAlarm
is lostFix is trivial, but might require more rework to fix this all.
Expected Behavior
I expected an ARN of the form:
Current Behavior
I got an ARN of the form:
I tried using this as a rollback trigger, and got the error:
Reproduction Steps
Call code as such:
Possible Solution
https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/aws-cloudwatch/lib/composite-alarm.ts#L76-L80
Pass in
arnFormat: ArnFormat.COLON_RESOURCE_NAME
.Also below:
https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/aws-cloudwatch/lib/composite-alarm.ts#L93
Use
ArnFormat.COLON_RESOURCE_NAME
.Suggest aligning these methods with
Alarm
class as well.Additional Information/Context
No response
CDK CLI Version
2.68.0 (build 25fda51)
Framework Version
No response
Node.js Version
v19.7.0
OS
Linux codespaces-3481fc 5.4.0-1104-azure #110~18.04.1-Ubuntu SMP Sat Feb 11 17:41:21 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Language
Typescript
Language Version
Version 4.9.5
Other information
No response
The text was updated successfully, but these errors were encountered: