DataDog / datadog-cloudformation-macro

CloudFormation Macros by Datadog
Apache License 2.0
14 stars 22 forks source link

Allow expiry of all logs #123

Open elruwen opened 6 months ago

elruwen commented 6 months ago

Before this change, the copy lambda creates a log group which never expires. When you manage lots of AWS accounts and you want to make sure that all cloudwatch log groups expire at some point, this can get very annoying.

I renamed the logical id of the function, so that a new function is created and therefore we get a chance to create the log group. Otherwise the stack would fail since there would be already an existing log group.

What does this PR do?

Expire the log group of the copy function.

Motivation

We centrally running analysis to make sure that all cloud watch log groups have an expiry set. This one always sticks out. That is annoying.

Testing Guidelines

I deployed the stack to avoid timing issues.

Additional Notes

Types of changes

Check all that apply

duncanista commented 5 months ago

Hey @elruwen, thanks for contributing. Sorry for taking so long.

I think if we were to do this change, without adding the V2 it would require us to do a breaking change. Let me get back to you on what our best option is, but I guess we'll just add your change without the suffix and make it breaking.

duncanista commented 5 months ago

I think it would be ideal to have the policy as a conditional, if the log group already exists, then don't create it. That way we can ensure that there are no breaking changes, what do you think about this?

elruwen commented 5 months ago

Sounds good, let me give that a try

duncanista commented 5 months ago

Hey @elruwen,

Let me know if you get to an alternative, I tried but fail multiple times. I'm afraid we might have to end up adding a breaking change at the end 😅