Terraform-aws-eks: Version 5.0.0 Error: Incorrect attribute value type

Created on 19 Jun 2019  路  4Comments  路  Source: terraform-aws-modules/terraform-aws-eks

I have issues

I'm submitting a...

  • [ ] bug report
  • [ ] feature request
  • [x] support request
  • [ ] kudos, thank you, warm fuzzy

What is the current behavior?

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.

If this is a bug, how to reproduce? Please include a code sample if relevant.

What's the expected behavior?

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

Are you able to fix this problem and submit a PR? Link here if you have already.

Environment details

  • Affected module version: 5.0.0
  • OS: High Sierra, 10.13.4
  • Terraform version: 0.12.2

Any other relevant info

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.

All 4 comments

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]]

Was this page helpful?
0 / 5 - 0 ratings