You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While adding a cloudwatchLog trigger event (subscription event) to a function that has many of them, we're wrongly relying on a counter to create the CloudFormation's Logical IDs, and if we change the order of by just swapping a couple, deleting, or adding new (that's not in the end), we hit a ResourceExceeded error.
Now even though the performUserExperiments fn has not changed at all since its LogicalID changed, CloudFormation will try to create a new resource, in parallel while it applies the update at SumologicLoggingLogsSubscriptionFilterCloudWatchLog1, which before was pointing to performUserExperiments, but now it's pointing to getUserExperiments. This is an update that requires a new resource from scratch, by the way.
Proposed Fix
Get rid of this count completely, and use the name of the log group as part of the Logical ID.
For example, assuming we have:
/aws/lambda/performUserExperiment (log group)
sumologic-logging-dev (function that will be called by the log group)
The text was updated successfully, but these errors were encountered:
rdsedmundo
changed the title
Use function name instead of counter for multiple cloudwatchLogs for avoiding SubscriptionFilter limit exceeded error
Use function name instead of counter for multiple cloudwatchLogs for avoiding SubscriptionFilter resourceexceeded error
Jun 17, 2019
rdsedmundo
changed the title
Use function name instead of counter for multiple cloudwatchLogs for avoiding SubscriptionFilter resourceexceeded error
Use function name instead of counter for multiple cloudwatchLogs for avoiding SubscriptionFilter ResourceExceeded error
Jun 17, 2019
This is a Bug Report
Description
While adding a cloudwatchLog trigger event (subscription event) to a function that has many of them, we're wrongly relying on a counter to create the CloudFormation's Logical IDs, and if we change the order of by just swapping a couple, deleting, or adding new (that's not in the end), we hit a ResourceExceeded error.
Similar or dependent issues:
Additional Data
Serverless adds a count at the end of the Logical IDs that start with 1. See: https://github.com/serverless/serverless/blob/master/lib/plugins/aws/package/compile/events/cloudWatchLog/index.js#L79
Let's say we have this:
Which generates (simplified):
We add a new fn at the beginning:
Which generates:
Now even though the performUserExperiments fn has not changed at all since its LogicalID changed, CloudFormation will try to create a new resource, in parallel while it applies the update at SumologicLoggingLogsSubscriptionFilterCloudWatchLog1, which before was pointing to performUserExperiments, but now it's pointing to getUserExperiments. This is an update that requires a new resource from scratch, by the way.
Proposed Fix
Get rid of this count completely, and use the name of the log group as part of the Logical ID.
For example, assuming we have:
We can name the Logical ID as:
Instead of:
I'm happy to send a PR if you believe that this approach makes sense. @medikoo @pmuens
The text was updated successfully, but these errors were encountered: