cloudposse / cloudposse/terraform-aws-eks-node-group
AMI auto detection works only for AL2/WINDOW OS
- Dominant language
- HCL
- Stars
- 99
- Forks
- 134
- PR merge metrics
- No merged PRs in 30d
Description
### 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_
Contributor guide
Research direction
Start with the suppress_bootstrap condition in userdata.tf, then trace features_require_ami and need_to_get_ami_id in maint.tf into the aws_ssm_parameter.ami_id data source in ami.tf. Confirm the module fetches the latest recommended AMI when ami_id and ami_release_version are unset for every supported OS family, including AL2023 and Bottlerocket.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, kubernetes, terraform
- Domain
- cloud, devops, infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100