fix: Ensure isra_tag_values
can be tried before defaulting to cluster_name
on Karpenter module
#2631
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
"Coalescelist" uses the first non-empty list. Since var.cluster_name defaults to an empty string, which creates a single-element array with an empty string as the only element (as well as it is almost always specified by the user for other resources such as the queue name and other cluster-named resources in this module) the custom tag values never take affect.
https://developer.hashicorp.com/terraform/language/functions/coalescelist
Motivation and Context
Without this change, passing in the cluster name and specifying custom tag values is not possible. this change is necessary to be able to share resources between clusters. For example, we use the same set of subnets for multiple development clusters with karpenter.sh/discovery/{cluster_name} = "shared" on the subnets for discovery.
Breaking Changes
This does not introduce a breaking change.
How Has This Been Tested?