-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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
Add s3_bucket_notification module #58059
Conversation
@aljazkosir, just so you are aware we have a dedicated Working Group for aws. |
bot_status |
Componentslib/ansible/modules/cloud/amazon/lambda_bucket_event.py test/units/modules/cloud/amazon/test_lambda_bucket_event.py Metadatawaiting_on: ansible |
ready_for_review |
This module seems the wrong approach - I'd prefer that this was just a parameter in the |
The test
The test
|
@willthames I updated the arguments and added test that checks that order of events doesn't matter |
description: | ||
- Name of the function alias. Mutually exclusive with C(version). | ||
required: false | ||
aliases: ['lambda_alias'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just call this argument lambda_alias
without the alias (just thinking about future proofing for other notification targets)
required: false | ||
aliases: ['lambda_alias'] | ||
type: str | ||
version: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just call this argument lambda_version
without the alias (just thinking about future proofing for other notification targets)
@@ -0,0 +1,2 @@ | |||
cloud/aws |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to make the test suite name match the module name. I don't mind if that's adding aws_
to the module name or removing aws_
from the test suite name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing _aws
from the test suite name seems better to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested this locally, everything looks great. Good to merge from my point of view
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this looks good, but I'm concerned about the 41MB function.zip. We have to carry this around in the repo (and ansible is already fairly hefty), and I'm getting timeouts on the "register lambda" test some of the time. This will likely lead to these tests being unstable in CI. It would be better to use a simple hello world style script like test/integration/targets/aws_lambda/files/mini_lambda.py
or test/integration/targets/lambda_policy/files/mini_http_lambda.py
.
I'd also personally prefer it if the function were in-repo as a regular file, then zipped in the test, from a review and accounting perspective. It makes it much easier to track and ensure that nothing is sneaking into the repo via a binary. |
- name: move lambda into place for archive module | ||
copy: | ||
src: "function.zip" | ||
dest: "{{output_dir}}/function.zip" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not include a file of this size in the repo. Use a very tiny lambda function and create the zip file during the test. If that's not possible, then we can put the zip file in our S3 bucket for CI -- but lets avoid that if possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally the lambda would be a singe python file with no requirements outside the standard library, then no zip would be needed. Keeping it python vs another language makes it easier to review since most contributors will be familiar with python.
I changed the authors, so the right people will be pinged. |
The test
|
The test
The test
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @aljazkosir that looks much better, appreciate all your work on this module!
SUMMARY
PR to introduce
lambda_bucket_event
module.ISSUE TYPE
COMPONENT NAME
ADDITIONAL INFORMATION
This module allows the management of AWS Lambda function bucket event mappings via the Ansible framework. Use module lambda to manage the lambda function itself, lambda_alias to manage function aliases and lambda_policy to modify lambda permissions.
Example: