Open rgarrigue opened 1 month ago
I can confirm this with module version 2.26, but also just from diving into the module code. The userdata for AL2023 completely ignores any values in the pre_bootstrap_user_data
and post_bootstrap_user_data
variables. I can see that the template file makes no reference to either variable.
Instead, completely new variables with new expected syntax were introduced: cloudinit_pre_nodeadm
and cloudinit_post_nodeadm
. I don't see these vars or the new behavior documented anywhere.
Is the intent to stop supporting the userdata vars in this module? Or was it an oversight to leave out those variables from the AL2023 template file?
Al2023 uses a different form of user data than AL2 - https://github.com/terraform-aws-modules/terraform-aws-eks/blob/97a08c8aff5dbf51a86b4c8cd88a858336cd0208/tests/user-data/main.tf#L108-L210
@bryantbiggs Yes, and Windows also has a different form of user data than AL2, but they use the same module variables to build the templates. Are the concepts all that different between AL2 and AL2023? AL2023 seems to work the same way that AL2 works when specifying an AMI in the launch template. The only difference is an additional section for a NodeConfig
in its multipart MIME.
I think this is just a matter of broken docs and expectations, not broken code. The logic for shimming a userdata script into a multipart MIME was already in this module, and it used the same userdata variables employed in other scenarios. So despite the fact that the new variables work well and allow flexibility in building a custom multipart MIME message, it is a bit unexpected to have new variables, especially given that the userdata readme still suggests using the older ones.
I'm happy to make some readme update suggestions, though I'm not sure I quite understand the conditionals in the userdata module, and I've probably misunderstood something in the new AL2023 format anyway. If I've just misunderstood, then sorry. In any case, thanks for the time spent on this.
An updated README would suit me fine, my current problem is I don't know how to get started
Description
I switched my EKSes managed node group to AMI_TYPE AL2023_x86_64_STANDARD (from AL2_x86_64 previously). Then my user_data stopped working, I can see this
Unhandled unknown content-type
injournalctl -u cloud-init.service
And comparing with AL2 worker nodes, the part-001 & co script files are absent, aka the scripts/ folder is empty
Versions
Module version [Required]: 20.24.2
Terraform version: ```Terraform v1.6.6 on linux_amd64
provider registry.terraform.io/hashicorp/aws v5.72.1
provider registry.terraform.io/hashicorp/cloudinit v2.3.5
provider registry.terraform.io/hashicorp/kubernetes v2.21.1
provider registry.terraform.io/hashicorp/null v3.2.3
provider registry.terraform.io/hashicorp/time v0.12.1
provider registry.terraform.io/hashicorp/tls v4.0.6```
Provider version(s): Execute: terraform providers -version : same output as above (issue template to be updated ?)
Reproduction Code [Required]
Steps to reproduce the behavior:
No workspace Local cache cleared List steps : replace AMI_TYPE value by AL2023_x86_64_STANDARD
Expected behavior
My user data to be executed, hence the ops user created, so with this ~/.ssh/config
I can
Actual behavior
I have to open the AWS console, go to EC2 instance, connect via SSM, sudo, execute my user data, and only then I can SSH in as intended behavior.
Edit
Fixed TF snippet, tried with module latest 20.26.0, not better