-
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
Add destroy invocation to aws_lambda_invocation resource #23555
Comments
We have recently developed a provider to address this, along with some other issues, if you'd like to check: https://registry.terraform.io/providers/thetradedesk/lambdabased |
I've opened #29367 which would trigger the Lambda function on every resource state transition. It will manipulate the JSON payload to provide details to the Lambda function. It will add a key This way there is no need to provision multiple lambda functions as a single function can handle each event accordingly. |
That's quite nice, thanks for sharing! Would love to see the something like the finalizer in the aws provider resource as well. |
This seems to have been moved to a private repo now. |
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 issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Community Note
Description
The aws_lambda_invocation resource is quite new, and is an excellent addition. However, it does not offer the ability to invoke a Lambda upon destruction of the resource, which limits its usefulness.
For example, I'd like to use this resource to automatically create database users when I create RDS clusters in a private VPC that cannot be accessed from the machine running Terraform. I can now do that by creating a Lambda in that VPC that can create users, and then using this resource to invoke that Lambda once for each user I'd like to create.
But then, how can I delete the database users if I no longer need them? Ideally, I'd be able to set a
destruction
configuration block which would allow me to do that, similar to thelocal-exec
provisioner withwhen = destroy
. If this configuration block is provided, the Lambda would be invoked again upon destruction with the associated configuration.New or Affected Resource(s)
Potential Terraform Configuration
The text was updated successfully, but these errors were encountered: