‼️ (aws-cloudwatch): cross account alarms cause failures in unsupported regions #16874
Labels
@aws-cdk/aws-cloudwatch
Related to Amazon CloudWatch
bug
This issue is a bug.
needs-triage
This issue or PR still needs to be triaged.
p0
Workaround is available 👇
What is the problem?
When deploying an
@aws-cdk/aws-cloudwatch.Alarm
in regions with no support for cross-account alarms, the deployment fails with the following error:This is because the change in #16007 always adds an
AccountId
to metrics.Reproduction Steps
Define a CDK stack with an AWS CloudWatch Alarm and deploy it to a region that still does not have support for cross-account alarms.
What did you expect to happen?
Success
What actually happened?
CDK CLI Version
1.126.0
Framework Version
1.126.0
Node.js Version
N/A
OS
N/A
Language
Typescript, Python, .NET, Java, Go
Language Version
N/A
Other information
Ref: P53531109
Workaround
You can delete the
AccountId
property by locating theCfnResource
behind thecloudwatch.Alarm
construct and then callingaddPropertyDeletionOverride
.Consider the following example:
This is how the
AWS::CloudWatch::Alarm
is synthesized:The following code will delete the
AccountId
property from the metric at index 0 (Metrics.0
) in the alarm:The text was updated successfully, but these errors were encountered: