pulumi-eks: Custom launch template is not used when creating a new Managed Node Group
Hello!
- Vote on this issue by adding a đ reaction
- To contribute a fix for this issue, leave a comment (and link to your pull request, if youâve opened one already)
Issue details
When creating a new Managed Node Group, I specified a custom (ec2) launch template via launchTemplate.
Though, newly launched EC2 instances do not appear to be using this launch template since the EC2 instance tag name aws:ec2launchtemplate:id refers to the one created by this provider instead.
Steps to reproduce
- Use https://github.com/pulumi/pulumi-eks/tree/master/examples/managed-nodegroups as a starting point
- Create a new launch template as part of your code
const launchTemplate = new aws.ec2.LaunchTemplate("my-launch-template", {
tags: {testTag: "tag value"},
});
- Set the launch template for the managed node group like this
...
launchTemplate: {
id: launchTemplate.id,
version: '$Latest'
}
- Deploy your changes
Expected: The custom launch template is used to launch new EC2 instances. Actual: The default launch template created by this provider is used.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 3
- Comments: 21 (4 by maintainers)
Facing the same issue, created a launch template but it is not being applied to the managed node group with the latest packages.
Thanks for the response @sushantkumar-amagi. OK so Iâve done some more testing with this, and itâs actually pretty weird (or maybe Iâm misunderstanding how EKS does Node Groups / custom launch templates?)
I create an EKS cluster with 2 MNGs. One specifies a launch template, the other doesnât. Both of the MNGs get created. In the EKS console I can see that MNG 1 is using my custom LT, MNG 2 has no LT. So far so good.
Now when I visit the Autoscaling groups for the nodes for each MNG, the ASG for MNG 1 has a launchtemplate that is created by Pulumi/EKS, not my custom one. However, the auto-created / attached LT does have the configuration from my custom LT (SSH key, other settings, etcâŚ). Maybe itâs copied over during creation? So the whole process is obviously aware of my LT. This is fine for a one shot, but if I ever want to go and update the LT in pulumi and apply it then it will have no effect as the ASGs are using the auto-created LT with the configuration from my original run of the custom LT creation.
I wonder if others are actually hitting this issue and theyâre just not noticing because the config works as expected (copied over) and they never update their original LT so donât notice changes arenât being propagated?
Hello,
EKS copies the launch template one gives to him (it seems to add some default settings): https://docs.aws.amazon.com/eks/latest/userguide/launch-templates.html
Reopening this with a question from the community Slack:
idis an Output, so you need to interpolate it:More context:
https://www.pulumi.com/registry/packages/aws/api-docs/ec2/launchtemplate/#outputs https://www.pulumi.com/docs/intro/concepts/inputs-outputs/#outputs-and-strings
It is not recommended to use â$Latestâ for the launch template version because the AWS API will this as 1 and parse it as drift every time, causing Pulumi to delete-replace it.