AMI auto detection works only for AL2/WINDOW OS
Describe the Bug
Addition of AL2023 support introduced in https://github.com/cloudposse/terraform-aws-eks-node-group/pull/186 did not add support for AMI auto detection for this OS family and potentially break it for Bottlerocket.
This contradicts with ami_release_version variable description The EKS AMI "release version" to use. Defaults to the latest recommended version..
Maybe I am missing here something, but AMI ID auto detection should not be conditioned by a detection if OS bootstrapping should be done or not.
Expected Behavior
When AMI is not provided via module variables, i.e. ami_id, ami_release_version the module should auto-detect latest/recommended version of the AMI for all supported OS families.
Steps to Reproduce
The problem originates in condition the following condition in userdata.tf:
suppress_bootstrap = local.enabled && (local.ami_os == "AL2" || local.ami_os == "WINDOWS") ? (
length(var.bootstrap_additional_options) > 0 || length(var.kubelet_additional_options) > 0 || length(var.after_cluster_joining_userdata) > 0
) : false
which is used in maint.tf
features_require_ami = local.enabled && local.suppress_bootstrap
need_to_get_ami_id = local.enabled && local.features_require_ami && !local.given_ami_id
that controls, if AMI ID is fetched using SSM parameter in ami.tf
data "aws_ssm_parameter" "ami_id" {
count = local.need_to_get_ami_id && !local.is_window_version ? 1 : 0
....
resulting in AMI ID NOT being fetched for AL2023, BOTTLEROCKET OSes.
Screenshots
No response
Environment
- Module version 3.3.2
- Terraform version 1.12
Additional Context
No response