Skip to main content
Knowledge Base

Error when trying to create node labels with eks-cluster

Answer

Im having an issue with trying to get node labels and taints working with eks-cluster module (v0.38.0 - `git::git@github.com:gruntwork-io/terraform-aws-service-catalog.git//modules/services/eks-cluster?ref=v0.38.0`). If i set the labels inside the `tags` attribute, the label names get prefixed with [http://ec2.amazonaws.com](http://ec2.amazonaws.com) and when I try to use `eks_kubelet_extra_args` attribute inside autoscaling_group_configurations as follows, I get the below error. config: ``` autoscaling_group_configurations = { "ml" = { min_size = "0" max_size = "0" asg_instance_type = "g4dn.12xlarge" subnet_ids = dependency.vpc.outputs.private_app_subnet_ids eks_kubelet_extra_args = "--node-labels=k8s.io/cluster-autoscaler/node-template/taint/dedicated='nvidia.com/gpu=true',k8s.io/cluster-autoscaler/node-template/label/nvidia.com/gpu=true,k8s.io/cluster-autoscaler/enabled=true" } ``` error: ``` ╷ │ Error: Inconsistent conditional result types │ │ on .terraform/modules/eks_workers/modules/eks-cluster-workers/main.tf line 101, in resource "aws_launch_configuration" "eks_worker": │ 101: for_each = var.create_resources ? local.combined_autoscaling_group_configurations : {} │ ├──────────────── │ │ local.combined_autoscaling_group_configurations is object with 3 attributes │ │ var.create_resources is true │ │ The true and false result expressions must have consistent types. The given │ expressions are object and object, respectively. ╵ Releasing state lock. This may take a few moments... ERRO[0103] 1 error occurred: * exit status 1 ``` I can not try to use a newer version of the eks-cluster module since it sort of tries to recreate the entire infrastructure and even then Im not sure if the error I see would go away. Any thoughts?

This was a bug in the older module version, which was fixed with this PR https://github.com/gruntwork-io/terraform-aws-eks/pull/318 This PR was merged into terraform-aws-eks version https://github.com/gruntwork-io/terraform-aws-eks/releases/tag/v0.38.0, which was rolled out to the service catalog in version [0.42.0](https://github.com/gruntwork-io/terraform-aws-service-catalog/releases/tag/v0.42.0). So if you upgrade to at least that version, this bug should be resolved.