fix: Prevent node_role_arn from being set when compute_config.node_pools is empty #3488
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fixes #3483
This commit fixes an issue where creating or updating an EKS auto mode cluster would fail when node_pools is empty but create_node_iam_role is true. The module was attempting to set node_role_arn in the compute_config block even when no node pools were specified, causing an AWS API error.
The fix ensures that node_role_arn is only set when node_pools is not empty, restoring functionality that existed in v20.31.2.
Motivation and Context
When using EKS auto mode with empty node pools, the module was incorrectly attempting to set the node_role_arn parameter in the AWS API call, which is not allowed when no node pools are specified. This caused deployments to fail with an API error.
This issue was introduced after v20.31.2 and affects users who are using the auto mode feature without specifying node pools.
Breaking Changes
No. This change restores the previous behavior from v20.31.2 and does not break backward compatibility.
How Has This Been Tested?
examples/*
to demonstrate and validate my change(s)examples/*
projectspre-commit run -a
on my pull request