terraform-aws-modules / terraform-aws-eks

Terraform module to create Amazon Elastic Kubernetes (EKS) resources 🇺🇦
https://registry.terraform.io/modules/terraform-aws-modules/eks/aws
Apache License 2.0
4.47k stars 4.08k forks source link

Incorrect attribute value type error when using terraform 0.12 and terraform-aws-eks v5.0.0 #414

Closed mojochao closed 5 years ago

mojochao commented 5 years ago

I have issues

I am trying to upgrade to use of terraform 0.12.x with terraform-aws-eks module v5.0.0, and am experiencing an error.

I'm submitting a...

What is the current behavior?

After updating terraform to latest 0.12.3 version, changed my use of the module to v5.0.0 of the terraform-aws-eks module as follows:

module "terraform_aws_eks" {
source = "github.com/terraform-aws-modules/terraform-aws-eks?ref=v5.0.0"

cluster_name    = var.identity
cluster_version = var.kubernetes_version
subnets         = var.aws_subnets
tags            = var.tags
vpc_id          = var.aws_vpc

write_kubeconfig   = true
config_output_path = pathexpand("~/.kube/")
kubeconfig_name    = var.identity

worker_groups = [
    {
    asg_desired_capacity           = var.num_workers_desired
    asg_max_size                   = var.num_workers_max
    asg_min_size                   = var.num_workers_min
    autoscaling_enabled            = true
    create_elb_service_linked_role = true
    instance_type                  = var.worker_instance_type
    key_name                       = var.ssh_key_name
    name_prefix                    = "${var.identity}_worker_group"
    public_ip                      = true
    subnets                        = join(",", var.aws_subnets)
    },
]

worker_sg_ingress_from_port = "22"
}

When I run terraform plan I see the following error:

$ terraform-0.12.3 plan
provider.aws.region
The region where AWS operations will take place. Examples
are us-east-1, us-west-2, etc.

Enter a value: us-west-2

Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

module.usw2.module.eks.module.coresvcs_eks.module.terraform_aws_eks.data.aws_region.current: Refreshing state...
module.usw2.module.eks.module.coresvcs_eks.module.terraform_aws_eks.data.aws_caller_identity.current: Refreshing state...
module.usw2.module.eks.module.coresvcs_eks.module.terraform_aws_eks.data.aws_ami.eks_worker: Refreshing state...
module.usw2.module.eks.module.coresvcs_eks.module.terraform_aws_eks.data.aws_iam_policy_document.cluster_assume_role_policy: Refreshing state...
module.usw2.module.eks.module.coresvcs_eks.module.terraform_aws_eks.data.aws_iam_policy_document.workers_assume_role_policy: Refreshing state...

------------------------------------------------------------------------

Error: Incorrect attribute value type

on .terraform/modules/usw2.eks.coresvcs_eks.terraform_aws_eks/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.

Create an instance of the terraform-aws-eks module v5.0.0 as shown above and run terraform plan on it.

What's the expected behavior?

Successful creation of the EKS cluster

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

No. Please advise.

Environment details

Any other relevant info

srikanthkodali9 commented 5 years ago

Drop the join on var.aws_subnets as the vpc_zone_identifier does the split. subnets = var.aws_subnets

mojochao commented 5 years ago

That fixed it. Everything working as expected now. Thanks!

tyanko1 commented 4 years ago

@srikanthkodali9 you da man

github-actions[bot] commented 1 year ago

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.