For customers who provide forwarderArn, create log groups and subscription filters through AWS SDK createLogGroup and putSubscriptionFilter instead of adding declarations to the CloudFormation template.
Motivation
Currently, customers who are deploying their Lambdas for the first time will run into potential issues in later deployments. When the macro creates a log group and subscription filter by adding declarations to the template, this works fine the first time, but for later deployments, applying the macro again will result in those resources being deleted. This is because we currently have no way to determine which log groups were created by the macro. (If a log group was created by a macro in a previous iteration, we should add the declaration again to make sure it doesn't get removed.) This solution removes template declarations and uses AWS SDK to create these resources.
Limitation: using the AWS SDK to create the log group requires customers to provide the optional FunctionName parameter.
For more details, see the Jira ticket.
Testing Guidelines
Modified unit tests and tested with deployments for both SAM and CDK in sandbox account.
What does this PR do?
For customers who provide
forwarderArn
, create log groups and subscription filters through AWS SDKcreateLogGroup
andputSubscriptionFilter
instead of adding declarations to the CloudFormation template.Motivation
Currently, customers who are deploying their Lambdas for the first time will run into potential issues in later deployments. When the macro creates a log group and subscription filter by adding declarations to the template, this works fine the first time, but for later deployments, applying the macro again will result in those resources being deleted. This is because we currently have no way to determine which log groups were created by the macro. (If a log group was created by a macro in a previous iteration, we should add the declaration again to make sure it doesn't get removed.) This solution removes template declarations and uses AWS SDK to create these resources.
Limitation: using the AWS SDK to create the log group requires customers to provide the optional
FunctionName
parameter. For more details, see the Jira ticket.Testing Guidelines
Modified unit tests and tested with deployments for both SAM and CDK in sandbox account.
Types of changes