Skip to content

Conversation

@james-menzies
Copy link

@james-menzies james-menzies commented Nov 26, 2025

Description

Add a prefix_separator variable into the self_managed_node_groups variable schema, and use it to override the hard-coded '-' separator when providing name_prefix values to underlying AWS resources. This is functionally identical to the prefix_separator variable on the top level-variable definition.

Motivation and Context

I've found that when upgrading from v17 when using a self-managed node group, that the aws_launch_template resource can take a while to replace (around 7 minutes) and in that time, the cluster is not able to receive any incoming traffic.

In the v18 upgrade guide, the strategy around using the prefix_separator to replace '-' with '' works well with respect to ensuring that the EKS cluster itself can be updated in-place, however the same strategy cannot be applied to the AWS Launch template resource due to the hard coded hyphen separator.

Breaking Changes

No breaking changes. I did consider propagating the prefix_separator directly from the top-level variable schema, however decided against that as it would potentially create breaking behaviour for existing users.

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

For testing:

  • I first applied the self-managed node groups example from the master branch.
  • I then changed to the head of this branch and re-ran terraform plan.
  • There were no changes (expected).
  • Then I added an explicit prefix_separator of -.
  • Again, no changes (expected).
  • Then I changed the separator to an empty string.
  • All affected resources that use the prefix separator needed to be replaced (expected).

I didn't see any use of straying from using the default names in the examples directory, so I didn't add anything to it, but am happy to update it if desired.

use_name_prefix = each.value.use_name_prefix
name = coalesce(each.value.name, each.key)
use_name_prefix = each.value.use_name_prefix
prefix_separator = each.value.prefix_separator != null ? each.value.prefix_separator : "-"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opted for this strategy rather than coalesce so that an empty string is not clobbered by the default.

@bryantbiggs
Copy link
Member

Thank you, but unfortunately this is not a change that we are looking to carry forward


name = var.iam_role_use_name_prefix ? null : local.iam_role_name
name_prefix = var.iam_role_use_name_prefix ? "${local.iam_role_name}-" : null
name_prefix = var.iam_role_use_name_prefix ? "${local.iam_role_name}${var.prefix_separator}" : null
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I replaced all instances where I felt the separator was hard-coded in this file for consistency, but am happy to take some out if appropriate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants