Skip to content

Conversation

jixun999
Copy link

@jixun999 jixun999 commented May 8, 2025

Description

For the case where we are NOT using eks-auto mode, the previous for_each condition looks at length of var.cluster_compute_config, which is fine if we don't specify the variable cluster_compute_config. However, in the event if one needs to create a module referencing this module and makes an eks-auto toggle, this variable needs to be specified in the downstream module.

Motivation and Context

By making this change, it is more robust and allows downstream consumer to make a module that works for both eks-auto and normal eks.

Breaking Changes

No breaking change

How Has This Been Tested?

  • I have updated at least one of the examples/* to demonstrate and validate my change(s)
  • I have tested and validated these changes using one or more of the provided examples/* projects
  • I have executed pre-commit run -a on my pull request

I have tested this in my environment, you could reproduce it by writing a new module to reference this eks module with the variable var.cluster_compute_config (type for each component needs to match).

In the new module:

module "eks" {
  cluster_compute_config = var.cluster_compute_config
  # everything else
}

variable "cluster_compute_config" {
  type = object({
    enabled = bool
    node_pools = list(string)
    node_role_arn = string
  })
  
  default = {
    enabled = false
    node_pools = []
    node_role_arn = ""
  }

Examples to use this new module:

For enabling EKS auto:

module "eks-auto" {
  cluster_compute_config = {
    enabled = true
    node_pools = ["general-purpose"]
    node_role_arn = "NODE_ROLE_ARN"
   }
   # everything else
 }
}

For standard EKS (NOT EKS Auto)

You could ignore this variable and it will take the default variable value

When not using eks-auto mode, the compute_config for_each condition checks the length of var.cluster_compute_config, which works fine if the variable is not specified. However, if a downstream consumer wants to create a module that toggles eks-auto, then cluster_compute_config must be defined. This change makes the module more robust and ensures it can support both eks-auto and standard EKS configurations.
@jixun999 jixun999 changed the title fix: more robust and cleaner compute_config fix: Enable cleaner and more robust compute_config variable for downstream module consumption May 9, 2025
@pexa-sdowney
Copy link

Hi people! Any chance this PR could get a review soon? We are hitting this exact issue with null values in cluster_compute_config and is causing issues with being able to toggle auto modes on or off. Would be super helpful to get this merged. Thanks!

@bryantbiggs
Copy link
Member

closing this as a duplicate of #3273 for now - we aren't making any further changes until there is resolution upstream at the provider to handle this

@github-actions
Copy link

I'm going to lock this pull request 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 related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants