Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deleting trigger and filters created as part of stack deletion #4

Merged
merged 3 commits into from
Dec 6, 2024

Conversation

hrai-nr
Copy link
Contributor

@hrai-nr hrai-nr commented Dec 4, 2024

After this code changes:

  1. On stack deletion, we will delete any S3 trigger event notification created as part of this particular stack.
  2. On stack deletion, we will delete any subscription filter created on any log group created as part of this particular stack

Testing:

  1. Create a stack, give a S3 bucket name, see that event notification are created. Delete the stack, event notification should also be deleted.
  2. Take a S3 bucket, create a sample event trigger for some other event type other than s3:ObjectCreated:*, Now go and create a cloud formation stack here give the same S3 bucket name. Now go and check that there will be 2 event notification on this bucket. Delete the Cloud formation stack. Only the second event notification should get deleted. Any event notification created before stack creation should not get deleted.
  3. Create a stack with selecting log group name, see that a subscription filter is created. Delete the stack, the subscription filter should be deleted.
  4. Take a log group with existing subscription filter already present. Create a cloud formation stack with this particular stack, see that second subscription filter get created. Now delete this stack, only the second subscription filter should be deleted. The subscription filter created prior to our stack creation should not get deleted.
  5. It is working for prefix as well. Here is how I tested:
  • Create a bucket B1. and then create two folders (prefix) inside P1 and P2.
  • Go and manually add trigger for P1 and point it to some lambda xyz.
  • Now create a stack and give bucket B1 and prefix P2.
  • You can see two triggers for the bucket.
  • Delete the stack, only the trigger for P2 will be deleted since this will be associated with our lambda.

lambda-cloudwatch-trigger-stack.yaml Outdated Show resolved Hide resolved
s3-trigger-stack.yaml Show resolved Hide resolved
s3-trigger-stack.yaml Show resolved Hide resolved
s3-trigger-stack.yaml Outdated Show resolved Hide resolved
s3-trigger-stack.yaml Outdated Show resolved Hide resolved
s3-trigger-stack.yaml Show resolved Hide resolved
s3-trigger-stack.yaml Outdated Show resolved Hide resolved
s3-trigger-stack.yaml Show resolved Hide resolved
@hrai-nr hrai-nr merged commit 9787573 into main Dec 6, 2024
10 checks passed
@ahegdeNR ahegdeNR deleted the NR-337496-lambda branch January 3, 2025 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants