Closed eculver closed 1 month ago
Don't base64 encode it and it should work fine
Thanks for the feedback. The base64 encoding was part of the problem and it wasn't entirely obvious until I looked at the generated user data for the launch template.
The other part that threw me off initially was the fact that when I added user data, the plan output was saying that the autoscaling group was being deleted and was not being replaced. I suppose this is an artifact of Terraform itself more than anything, so I'm not sure how to make this go away.
For example, by adding only pre_bootstrap_user_data
this is what the plan output looked like:
...some parts unrelated parts omitted for simplicity...
# module.customer_eks.module.eks.module.eks_managed_node_group["query_nodes"].aws_eks_node_group.this[0] must be replaced
+/- resource "aws_eks_node_group" "this" {
...
~ resources = [
- {
- autoscaling_groups = [
- {
- name = "eks-query_nodes-20240827150752215800000001-2ec8ca30-8375-1070-cdf1-4b8558db3083"
},
]
- remote_access_security_group_id = ""
},
] -> (known after apply)
~ launch_template {
id = "lt-01ffe24699b0d35a6"
~ name = "query_nodes-20240827013628714900000030" -> (known after apply)
~ version = "1" -> (known after apply)
}
}
# module.customer_eks.module.eks.module.eks_managed_node_group["query_nodes"].aws_launch_template.this[0] will be updated in-place
~ resource "aws_launch_template" "this" {
~ default_version = 1 -> (known after apply)
id = "lt-01ffe24699b0d35a6"
~ latest_version = 1 -> (known after apply)
name = "query_nodes-20240827013628714900000030"
tags = {}
+ user_data = "<base64 user data>"
# (9 unchanged attributes hidden)
...
# (6 unchanged blocks hidden)
}
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.
Is your request related to a new offering from AWS?
Is this functionality available in the AWS provider for Terraform? See CHANGELOG.md, too.
Is your request related to a problem? Please describe.
Yes, if I try to define user data, in the form of pre_bootstrap_user_data or cloudinit_pre_nodeadm or any other variables that make their way into the user data of the launch template, it completely blows away the rest of the default launch template for the managed node group.
Describe the solution you'd like.
I'd like to be able to override and/or inject a small piece of functionality (as one would expect) by setting any of these inputs.
Describe alternatives you've considered.
I've considered defining and managing the launch template entirely on my own in order to get this functionality, but that entirely defeats the purpose of a "managed" node group -- I'm managing it at that point.
Additional context
I've looked through all the examples, closed issues (#3034 is close), all the code to see where I may be missing something and I can't find anything. Here's my simple example: