Error: Incorrect attribute value type
on .terraform/modules/application-eks/terraform-aws-modules-terraform-aws-eks-9c3d222/workers.tf line 37, in resource "aws_autoscaling_group" "workers":
37: vpc_zone_identifier = lookup(
Inappropriate value for attribute "vpc_zone_identifier": set of string
required.
Subnets passed into the module should be picked up by the worker groups.
Adding
subnets = data.terraform_remote_state.vpc.outputs.private_subnets
to the worker_group_defaults also throws the same error
Hey @tokiwong I ran into this same issue myself tonight and I found this: https://github.com/terraform-aws-modules/terraform-aws-eks/pull/394
After setting my worker_groups.subnets value to a list of subnets, I was able to get passed this error. I previously had my subnets defined as a string and was getting that same error you're experiencing.
I have my code looking up all the Subnets that I am using. I checked in the console and the output of the value is in a list format but I am still getting the same error.
module "eks" {
source = "terraform-aws-modules/eks/aws"
version = "5.0.0" # As of this writting this is the lastes version
cluster_name = "${var.aws_cluster_name}-eks" # the name to give the EKS cluster
subnets = data.aws_subnet.private.*.id # the list of subnets to use
vpc_id = var.vpc_id # the VPC that will be used
With the data output being this in the console.
> data.aws_subnet.private.*.id
[
"subnet-0647e",
"subnet-03cc3",
"subnet-064c2",
]
From what I can tell I am pass a list.
I was able to fix my problem by adding the subnets to the worker_groups values.
@helenes-r7 Thanks for the tip, I was able to fix my problem. One of my worker groups had their subnets set to:
subnets = data.terraform_remote_state.vpc.outputs.private_subnets[0]
which was of type string, and it was fixed by changing it to:
subnets = [data.terraform_remote_state.vpc.outputs.private_subnets[0]]
Most helpful comment
Hey @tokiwong I ran into this same issue myself tonight and I found this: https://github.com/terraform-aws-modules/terraform-aws-eks/pull/394
After setting my worker_groups.subnets value to a list of subnets, I was able to get passed this error. I previously had my subnets defined as a string and was getting that same error you're experiencing.