serverless / serverless-plugin-log-retention

Control the retention of your serverless function's cloudwatch logs.
MIT License
21 stars 17 forks source link

add resources reference if missing #3

Closed jaymecd closed 4 years ago

jaymecd commented 4 years ago

This PR fixes following problem:

Log group retention remains Never as CFN is not aware of AWS::Logs::LogGroup resource, if serverless.yml file does not have resources defined.

As a workaround serverless.yml must have empty block, which is not very convenient to have:

resources: {}
dougmoscrop commented 4 years ago

Master has nco already on service.resources: https://github.com/ArtificerEntertainment/serverless-plugin-log-retention/blob/master/add-log-retention.js#L38

services.resources can be an Array as well as an Object. Can I suggest rather than trying to merge via resources.Resources, you just use the compiledCloudFormationTemplate object to modify the LogGroup directly?

ArtificerEntertainment commented 4 years ago

Thanks Doug!

jaymecd commented 4 years ago

@ArtificerEntertainment is there an issue or PR which addresses @dougmoscrop solution? Cause the problem remains unsolved while there is no resources block in yaml file.