-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
[Bug]: aws_lambda_function.replace_security_groups_on_destroy behaviour is no longer supported #31520
Comments
Community NoteVoting for Prioritization
Volunteering to Work on This Issue
|
I ran the ACC for this resource/use_case and got same result :
|
@jar-b given they appear to be redesigning how this is implemented underneath, it may be worth trying to get internal confirmation from AWS that there are no immediate plans to remove that feature as well, just to be safe. But yeah, sounds reasonable to me. |
We have been using a script very similar to the one metioned in #10329 (comment) As per @jar-b's suggestion, we've now changed the script to update the security group on the Lambda rather than the ENI, executing it in a destroy local-exec provisioner from a null_resource and the security group seems to take between 3 and 5 minutes to destroy now. The script we're using is:
Hopefully this can help somebody else seeing this problem (at least until AWS stop this from working too...) |
AWS has confirmed mutation of security groups on lambda ENI's is no longer permitted, and the change will not be rolled back. At this time they have recommended removing the logic and deprecating these attributes, which we'll be doing in the next minor release. |
This functionality has been released in v5.3.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. |
Description
A while back, a workaround was added to aws_lambda_function to try and speed up the destroy times for Lambda functions attached to a VPC with security groups. This effectively swapped the Hyperplane ENI security groups out with the VPC default security group to remove the ENI dependency on the initial security group, allowing builds to destroy much faster.
A couple of weeks ago, I noticed that in our cloud (eu-west-1), we were getting "Client.OperationNotPermitted" when Terraform attempted to do this.
I contacted AWS Support via my employer's enterprise support plan, and produced a minimal working example for them. They went to speak to one of the internal teams that develops AWS Lambda and provided a technical explanation for us. Effectively, it is no longer possible to update security groups on ENIs once created. I have no idea if this is rolled out globally yet or not, but we have managed to replicate this on three of our own AWS accounts in eu-west-1.
The official AWS response was as follows:
Their advice on working around this:
This is unfortunate as this feature reduced our destroy times by over an hour previously. However, it is probably worth marking this attribute as deprecated in the documentation with an explanation to prevent production impairment for other users.
References
AWS Enterprise Support Plan official support.
This was communicated from their internal team that develops AWS Lambda at AWS.
Would you like to implement a fix?
No
The text was updated successfully, but these errors were encountered: