-
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
Error updating Autoscaling group: InvalidQueryParameter: Invalid launch template: When a network interface is provided, the security groups must be a part of it. #4570
Comments
I get the same error in the EC2 console trying to create an ASG from the LT. I've put the security group everywhere I can think of. What am I missing? |
I reproduced this without terraform so I think this is an AWS issue, but this is interesting:
Now, go back and edit the launch template.
So I removed vpc_security_group_ids and now I get |
Hi! Is there any workaround? I commented the vpc_security_group_ids on the launch template configuration, and now it's working the deployment of the launch template and the auto scaling group, but I don't know if this is a big change on behavior. |
Greetings, Is there another workaround? Comment vpc_security_group_ids, did not work for me. |
Also having the same issue here. I don't think we should get rid of security groups, but even so, it is weird that it's complaining about SGs when they are mentioned in both |
Update:
The issue for me was that this was using the default version of the Launch Template instead of the latest one (as version increases automatically in aws even if you don't specify it). |
I tried doing what @Yashiroo did, but I still get there error. Did you clear terraform and manually delete the resources? This worked for me, but only after I attempted Yashiroo's workaround:
|
@afalko Sorry, i think my comment was incomplete.
The problem is, this is misleading since in terraform documentation, the example shows the usage of
But this does not work (at least did not work for me) and terraform complains about security groups that need to be added, even though no network interface was mentioned in that block. |
This is indeed the same in my configuration , which is exactly the same as what @Yashiroo mentioned. I have tried multiple approaches.
So I guess it's not fixed yet. I would check net on AWS console to test AWS Launch Template and ASG binding but I suspect it's the AWS API that's causing the failure. I will update after my tests. |
|
I was getting this error with this line within the
When I removed this line, ASG deployed. |
I was also able to get around this by removing To provide what seems to be a working example of the necessary parts:
I think this comes from a limitation in the EC2 API where instance security groups aren't compatible with network interfaces with public IP addresses (only the network interface will have a security group), but the vague error message makes me unsure. |
I encountered same problem and commenting out
|
I used another approach - switch back to EC2 Classic mode in the ASG - i.e. this is what I did:
Works perfectly! Only challenge for me is now to bring the list with availability_zones for autoscaling_group and the list of network_interfaces for launch_template into the same order - otherwise AWS will complain about az not matching between ENI and ASG... |
Has this issue been resolved? I am having the same issue when using launch_template in Batch. I think the two issues are connected. |
Can you please provider Terraform version and AWS Provider version @skyuuka ? |
Terraform version: v0.12.20 |
Can you please also paste the output of the error @skyuuka ? |
That's not a bug/issue, but intended behavior by AWS:
And confirmed by AWS (from my support ticket):
So in case setting network interface you just need to provide SG on the interface level and remove |
Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label. If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. 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
Terraform Version
Terraform v0.11.7
Affected Resource(s)
aws_autoscaling_group
aws_launch_template
Terraform Configuration Files
Debug Output
Important Factoids
It seems like the SGs are getting into the template, but I'm not sure why the ASG is complaining about the LT.
This is updating an ASG that previously had an LC.
References
#4364
The text was updated successfully, but these errors were encountered: