-
-
Notifications
You must be signed in to change notification settings - Fork 4.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
self_managed_node_group creates invalid launch template when using network_interfaces #1880
Comments
I don't think there is anything for us to do here, no? The error message from the API is pretty clear - a security group must be provided when creating a custom ENI - what solution are you looking for? |
The EKS module is creating the bad launch template. I can not get around that using the EKS module as it stands currently. |
I don't follow |
from the upstream issue you linked - hashicorp/terraform-provider-aws#4570 (comment) this is the intended behavior from the AWS API |
If you read the issue I linked you will see the error is misleading. To create a valid template you do need to define the security groups in the network_interfaces block which I have. But if you also set the vpc_security_groups_ids value in the launch_template you will get the error in the listed issue. So the problem is the EKS sub module is defining the vpc_security_groups_ids value always which creates an invalid template should you define any network interface. |
ya, I don't see this as an issue with the module here. to get around this its quite simple, create your own launch template and pass it into the module |
By that logic you might as well remove the network interfaces block from your help docs in the EKS module because per the issue we have been discussing you need to define a security group for a network interface and doing so will require that the vpc_security_groups_ids value be null in the launch_template. So from what I can tell this module can not use the network interfaces in any way with the self_managed_node_groups. |
correct - its dependent on *cluster creation, not node creation (needs endpoint, certificate, etc.). you can use the sub-modules separate from the root module though, this is how the root module is composed |
So there is no way to use the network_interfaces in a self_managed_node_group with the current EKS module? |
I don't know the answer to that question - I haven't tried it myself. I do find it hard to believe since we have this module as well as the autoscaling module https://github.com/bryantbiggs/terraform-aws-autoscaling/blob/master/main.tf#L172-L191 and this is the first time I am hearing about this. I am sure there is a way to make it work, you'll just have to get creative and figure out how |
Perhaps you are confused since I included EFA. If you remove the need for EFA the problem still exists. The network_interfaces block is unusable in the self_manage_node_groups. |
In an effort to make a simplified example I cloned the EKS repo and used the self_managed_node_group example.
The problem reproduces with the examples. I do not see a way the network_interfaces block can be used at all in EKS/self_managed_nodes with the current code. You will need to terraform apply to see the error.
|
It seems to be because Which resulted in And when And from Launch template doc here
You can fix this by manually going to the UI and create a new Launch Template version, move the common security group out and update the ASG. |
Thanks for the explanation. We ended up using a fork with a variation of the code fix I mentioned above. That ended up being a cleaner solution for us. |
This issue has been resolved in version 18.18.0 🎉 |
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. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Description
When using the EKS module to create a self managed node group if you define a network_interface in the self_managed_node_group sub module it will create an invalid template per issue hashicorp/terraform-provider-aws#4570. It looks like there needs to be a conditional for the vpc_security_group_ids value setting it to null when a network_interface is provided. I was able to get past the error and add the EFA interface_type I wanted by adding the following.
Although I ran into a new error. I was able to get past it by setting the variable to not create the Cloudwatch log group. I am not sure how the change is related to this new error.
│ Error: Creating CloudWatch Log Group failed: ResourceAlreadyExistsException: The specified log group already exists: The CloudWatch Log Group '/aws/eks/tf-west-test-vpc/cluster' already exists.
Versions
1.1.5
AWS 3.74.2
EKS 18.2.7
Reproduction
Steps to reproduce the behavior:
Create an EKS cluster using the EKS module with a self_managed_node_group that has a network_interface defined. This will create a clean plan but when you apply the the autoscaling group will fail to create due to the issue listed above (When a network interface is defined for a launch template the security groups must be defined in the network interfaces section and not with vpc_security_group_ids in the main block of the launch template.)
Code Snippet to Reproduce
Expected behavior
Successful creation of a self managed node group with an EFA interface
Actual behavior
Error on terraform apply.
│ Error: Error creating Auto Scaling Group: InvalidQueryParameter: Invalid launch template: When a network interface is provided, the security groups must be a part of it.
Terminal Output Screenshot(s)
Additional context
The text was updated successfully, but these errors were encountered: