You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Line 11 of fargate.tf was changed on 6th September for "Added ability to pass different subnets for fargate and the cluster" using a coalescelist.
Coalescelist works only if there is at least one variable in the lists to coalesce. This excludes it from being passed variables with nothing in them when create_eks is set to False, as the coalescelist requires calculation at plan, and errors.
create_eks is used as a flag to disable the creation of EKS environments, as a work around to the more typical count. However, this no longer works if variables for a subnet are not supplied.
Module:
terraform-aws-modules/eks/aws 17.15.0 affected, 17.14.0 is not.
Reproduction
Steps to reproduce the behavior:
Build two terraform files which use the eks module to provision an EKS cluster. Set one of them to create_eks = False and give an empty list for the subnets and fargate_subnets (which defaults to an empty list). Set the other with a populated subnet list.
Running a plan or apply, watch it error with:
Error: Error in function call │ │ on .terraform/modules/eks_cluster_ap_southeast_1.eks/fargate.tf line 11, in module "fargate": │ 11: subnets = coalescelist(var.fargate_subnets, var.subnets) │ ├──────────────── │ │ var.fargate_subnets is empty list of string │ │ var.subnets is empty list of string │ │ Call to function "coalescelist" failed: no non-null arguments.
You can see that we are using a lookup in order to get the subnets for each region. The lookup is controlled by the create_eks variable as well (see below), so with that set to false, there's nothing which is sent through.
data "aws_vpc" "eks_vpc" {
count = local.create_eks_count
tags = {
Name = var.vpc_name
}
}
Prior to v17.15.0, the create_eks flag would stop an EKS environment from being created as a substitute for the count option which is not viable as per the module's documentation. By supplying an empty variable for the subnet, terraform would continue to run, as it does not need to create anything.
Actual behavior
v17.15.0 causes terraform to exit with the error 'Call to function "coalescelist" failed: no non-null arguments.' even when create_eks is set to False. So one must supply a subnet even if the EKS module is not expected to be created.
Pinning the module version to v17.14.0 results in the error message going away and a successful deployment.
Terminal Output Screenshot(s)
Error: Error in function call
│
│ on .terraform/modules/eks_cluster_ap_southeast_1.eks/fargate.tf line 11, in module "fargate":
│ 11: subnets = coalescelist(var.fargate_subnets, var.subnets)
│ ├────────────────
│ │ var.fargate_subnets is empty list of string
│ │ var.subnets is empty list of string
│
│ Call to function "coalescelist" failed: no non-null arguments.
Additional context
The documentation does state that the input is required, but it defeats the purpose of the create_eks variable if subnets are required for regions where you aren't actually wanting to create an EKS cluster.
The text was updated successfully, but these errors were encountered:
I've just fixed it in #1576, v17.16.0 has been just released.
Currently, this module does require a bit too much when create_eks = true but it should not. It is something I am planning to improve during next week.
I'm going to lock this issue 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 similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Description
Line 11 of fargate.tf was changed on 6th September for "Added ability to pass different subnets for fargate and the cluster" using a coalescelist.
Coalescelist works only if there is at least one variable in the lists to coalesce. This excludes it from being passed variables with nothing in them when create_eks is set to False, as the coalescelist requires calculation at plan, and errors.
create_eks is used as a flag to disable the creation of EKS environments, as a work around to the more typical count. However, this no longer works if variables for a subnet are not supplied.
Terraform v1.0.3
on darwin_amd64
Terraform v1.0.3
on darwin_amd64
terraform-aws-modules/eks/aws 17.15.0 affected, 17.14.0 is not.
Reproduction
Steps to reproduce the behavior:
Build two terraform files which use the eks module to provision an EKS cluster. Set one of them to create_eks = False and give an empty list for the subnets and fargate_subnets (which defaults to an empty list). Set the other with a populated subnet list.
Running a plan or apply, watch it error with:
Error: Error in function call │ │ on .terraform/modules/eks_cluster_ap_southeast_1.eks/fargate.tf line 11, in module "fargate": │ 11: subnets = coalescelist(var.fargate_subnets, var.subnets) │ ├──────────────── │ │ var.fargate_subnets is empty list of string │ │ var.subnets is empty list of string │ │ Call to function "coalescelist" failed: no non-null arguments.
Yes. I have switched to the appropriate workspace
Yes, cleared local cache.
Code Snippet to Reproduce
module "eks" {
source = "terraform-aws-modules/eks/aws"
create_eks = var.create_eks
cluster_name = var.cluster_name
cluster_version = var.cluster_version
enable_irsa = true
vpc_id = one(data.aws_vpc.eks_vpc..id)
subnets = flatten(data.aws_subnet_ids.worker_subnets..ids)
write_kubeconfig = false
(removed the rest)
You can see that we are using a lookup in order to get the subnets for each region. The lookup is controlled by the create_eks variable as well (see below), so with that set to false, there's nothing which is sent through.
data "aws_vpc" "eks_vpc" {
count = local.create_eks_count
tags = {
Name = var.vpc_name
}
}
data "aws_subnet_ids" "worker_subnets" {
count = local.create_eks_count
vpc_id = one(data.aws_vpc.eks_vpc.*.id)
tags = {
Tier = "Private"
}
}
Expected behavior
Prior to v17.15.0, the create_eks flag would stop an EKS environment from being created as a substitute for the count option which is not viable as per the module's documentation. By supplying an empty variable for the subnet, terraform would continue to run, as it does not need to create anything.
Actual behavior
v17.15.0 causes terraform to exit with the error 'Call to function "coalescelist" failed: no non-null arguments.' even when create_eks is set to False. So one must supply a subnet even if the EKS module is not expected to be created.
Pinning the module version to v17.14.0 results in the error message going away and a successful deployment.
Terminal Output Screenshot(s)
Error: Error in function call
│
│ on .terraform/modules/eks_cluster_ap_southeast_1.eks/fargate.tf line 11, in module "fargate":
│ 11: subnets = coalescelist(var.fargate_subnets, var.subnets)
│ ├────────────────
│ │ var.fargate_subnets is empty list of string
│ │ var.subnets is empty list of string
│
│ Call to function "coalescelist" failed: no non-null arguments.
Additional context
The documentation does state that the input is required, but it defeats the purpose of the create_eks variable if subnets are required for regions where you aren't actually wanting to create an EKS cluster.
The text was updated successfully, but these errors were encountered: