-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
F aws lambda invocation crud support #29367
F aws lambda invocation crud support #29367
Conversation
Add a lifecycle_scope argument which allows configuring the lambda_invocation resource to trigger for each lifecycle transition of the terraform resource. By adding the argument it is possible to maintain backwards compatibility and enable lambda invocations for resource updates/deletes. See the updated documentation for a detailed explanation of the feature.
Add test cases for all the different resource state transitions: - create - update - delete Also verify that the terraform_key argument works as expected. Refactor existing tests a bit to avoid heavy duplication. Verified using: `make testacc TESTS=TestAccLambdaInvocation_lifecycle_ PKG=lambda` Both prior and after this commit all the tests pass.
Community NoteVoting for Prioritization
For Submitters
|
Hey @breathingdust @bflad wondering if this is a change that could make it into an upcoming version of the provider. This would be really useful for destroying things that a lambda is used to create at apply-time (for example, releasing IP space in IPAM upon VPC destruction where the lambda was responsible for allocating an available CIDR at plan/apply time). |
Hi @jacob-house-vgh 👋 This is in our immediate queue for review and I expect it to be picked up in the next few weeks. Appreciate your patience! |
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.
LGTM 🎉
$ make testacc TESTS=TestAccLambdaInvocation_ PKG=lambda
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/lambda/... -v -count 1 -parallel 20 -run='TestAccLambdaInvocation_' -timeout 180m
--- PASS: TestAccLambdaInvocation_lifecycle_scopeCRUDCreate (31.40s)
--- PASS: TestAccLambdaInvocation_qualifier (37.04s)
--- PASS: TestAccLambdaInvocation_lifecycle_scopeCRUDUpdateInput (55.27s)
--- PASS: TestAccLambdaInvocation_lifecycle_scopeCreateOnlyToCRUD (61.38s)
--- PASS: TestAccLambdaInvocation_lifecycle_scopeCreateOnlyUpdateInput (67.85s)
--- PASS: TestAccLambdaInvocation_basic (75.85s)
--- PASS: TestAccLambdaInvocation_lifecycle_scopeCRUDDestroy (81.37s)
--- PASS: TestAccLambdaInvocation_terraformKey (82.37s)
--- PASS: TestAccLambdaInvocation_complex (88.28s)
--- PASS: TestAccLambdaInvocation_triggers (88.77s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/lambda 91.921
Thanks for your contribution, @pvbouwel - looks great! I've added the |
Thanks for your contribution, @pvbouwel! 👍 |
This functionality has been released in v5.1.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Description
Enhance the aws_lambda_invocation resource by triggering on each resource state transition and therefore allowing full CRUD implementation. Manipulate the triggering JSON payload such that an update/delete has all the information it needs to be processed.
In order to be backwards compatible this behaviour is activated when lifecycle_scope is set to CRUD (defaults to CREATE_ONLY).
For in-depth description of the JSON payload that will be send to invoke the Lambda function see the documentation file in the PR. In short it adds a
tf
key which has anaction
(one ofcreate
,update
,delete
) and aprev_input
which provides the input that was for the previous invocation (this is required if a Lambda function can manage multiple resources).Relations
Closes #23555
Closes #21905
References
Output from Acceptance Testing