{"action":"created","issue":{"url":"https://api.github.com/repos/terraform-aws-modules/terraform-aws-eks/issues/73","repository_url":"https://api.github.com/repos/terraform-aws-modules/terraform-aws-eks","labels_url":"https://api.github.com/repos/terraform-aws-modules/terraform-aws-eks/issues/73/labels{/name}","comments_url":"https://api.github.com/repos/terraform-aws-modules/terraform-aws-eks/issues/73/comments","events_url":"https://api.github.com/repos/terraform-aws-modules/terraform-aws-eks/issues/73/events","html_url":"https://github.com/terraform-aws-modules/terraform-aws-eks/issues/73","id":342524286,"node_id":"MDU6SXNzdWUzNDI1MjQyODY=","number":73,"title":"Using computed values in worker group parameters results in `value of 'count' cannot be computed` error","user":{"login":"laverya","id":2318911,"node_id":"MDQ6VXNlcjIzMTg5MTE=","avatar_url":"https://avatars1.githubusercontent.com/u/2318911?v=4","gravatar_id":"","url":"https://api.github.com/users/laverya","html_url":"https://github.com/laverya","followers_url":"https://api.github.com/users/laverya/followers","following_url":"https://api.github.com/users/laverya/following{/other_user}","gists_url":"https://api.github.com/users/laverya/gists{/gist_id}","starred_url":"https://api.github.com/users/laverya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laverya/subscriptions","organizations_url":"https://api.github.com/users/laverya/orgs","repos_url":"https://api.github.com/users/laverya/repos","events_url":"https://api.github.com/users/laverya/events{/privacy}","received_events_url":"https://api.github.com/users/laverya/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-07-18T23:17:48Z","updated_at":"2018-07-19T01:53:58Z","closed_at":null,"author_association":"NONE","body":"# I have issues\r\n\r\n## I'm submitting a...\r\n\r\n* [x] bug report\r\n\r\n## What is the current behavior?\r\n\r\n`terraform plan` produces this output when any worker group parameters are computed values:\r\n\r\n```\r\nlaverya:~/dev$ terraform plan\r\nRefreshing Terraform state in-memory prior to plan...\r\nThe refreshed state will be used to calculate this plan, but will not be\r\npersisted to local or remote state storage.\r\n\r\ndata.http.workstation_external_ip: Refreshing state...\r\ndata.aws_region.current: Refreshing state...\r\ndata.aws_availability_zones.available: Refreshing state...\r\ndata.aws_iam_policy_document.cluster_assume_role_policy: Refreshing state...\r\ndata.aws_iam_policy_document.workers_assume_role_policy: Refreshing state...\r\ndata.aws_ami.eks_worker: Refreshing state...\r\n\r\nError: Error refreshing state: 1 error(s) occurred:\r\n\r\n* module.eks.data.template_file.userdata: data.template_file.userdata: value of 'count' cannot be computed\r\n```\r\n\r\n## If this is a bug, how to reproduce? Please include a code sample if relevant.\r\n\r\n```\r\nprovider \"aws\" {\r\n  version = \"~> 1.27\"\r\n  region  = \"us-east-1\"\r\n}\r\n\r\ndata \"aws_availability_zones\" \"available\" {}\r\n\r\nmodule \"vpc\" {\r\n  source  = \"terraform-aws-modules/vpc/aws\"\r\n  version = \"1.37.0\"\r\n  name    = \"eks-vpc\"\r\n  cidr    = \"10.0.0.0/16\"\r\n  azs     = [\"${data.aws_availability_zones.available.names[0]}\", \"${data.aws_availability_zones.available.names[1]}\", \"${data.aws_availability_zones.available.names[2]}\"]\r\n\r\n  private_subnets    = [\"10.0.1.0/24\", \"10.0.2.0/24\", \"10.0.3.0/24\"]\r\n  public_subnets     = [\"10.0.4.0/24\", \"10.0.5.0/24\", \"10.0.6.0/24\"]\r\n\r\n  tags = \"${map(\"kubernetes.io/cluster/terraform-eks\", \"shared\")}\"\r\n}\r\n\r\nmodule \"eks\" {\r\n  source  = \"terraform-aws-modules/eks/aws\"\r\n  version = \"1.3.0\"\r\n  cluster_name = \"terraform-eks\"\r\n  subnets = [\"${module.vpc.private_subnets}\", \"${module.vpc.public_subnets}\"]\r\n  tags    = \"${map(\"Environment\", \"test\")}\"\r\n  vpc_id = \"${module.vpc.vpc_id}\"\r\n\r\n  worker_groups = [\r\n    {\r\n      name          = \"default-m5-large\"\r\n      instance_type = \"m5.large\"\r\n\r\n      subnets = \"\"\r\n      # subnets = \"${join(\",\", module.vpc.private_subnets)}\"\r\n    },\r\n  ]\r\n}\r\n```\r\n\r\nUncomment `subnets = \"${join(\",\", module.vpc.private_subnets)}\"` to replace `subnets = \"\"` in the worker_groups config and run `terraform plan`.\r\n\r\n## What's the expected behavior?\r\n\r\n`terraform plan` completes and a plan is produced.\r\n\r\n## Are you able to fix this problem and submit a PR? Link here if you have already.\r\n\r\nI have not yet identified the root cause.\r\n\r\n## Environment details\r\n\r\n* Affected module version: 1.3.0\r\n* OS: Ubuntu 16.04\r\n* Terraform version: Terraform v0.11.7\r\n\r\n## Any other relevant info\r\n\r\nThis makes it rather difficult to assign subnets to worker groups."},"comment":{"url":"https://api.github.com/repos/terraform-aws-modules/terraform-aws-eks/issues/comments/406129218","html_url":"https://github.com/terraform-aws-modules/terraform-aws-eks/issues/73#issuecomment-406129218","issue_url":"https://api.github.com/repos/terraform-aws-modules/terraform-aws-eks/issues/73","id":406129218,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNjEyOTIxOA==","user":{"login":"laverya","id":2318911,"node_id":"MDQ6VXNlcjIzMTg5MTE=","avatar_url":"https://avatars1.githubusercontent.com/u/2318911?v=4","gravatar_id":"","url":"https://api.github.com/users/laverya","html_url":"https://github.com/laverya","followers_url":"https://api.github.com/users/laverya/followers","following_url":"https://api.github.com/users/laverya/following{/other_user}","gists_url":"https://api.github.com/users/laverya/gists{/gist_id}","starred_url":"https://api.github.com/users/laverya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laverya/subscriptions","organizations_url":"https://api.github.com/users/laverya/orgs","repos_url":"https://api.github.com/users/laverya/repos","events_url":"https://api.github.com/users/laverya/events{/privacy}","received_events_url":"https://api.github.com/users/laverya/received_events","type":"User","site_admin":false},"created_at":"2018-07-19T01:53:58Z","updated_at":"2018-07-19T01:53:58Z","author_association":"NONE","body":"I've been debugging a bit myself and it seems to be these three locations: \r\n\r\nhttps://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/workers.tf#L8\r\nhttps://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/workers.tf#L33\r\nhttps://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/data.tf#L78\r\n\r\nI don't think `length()` can be applied to computed values.\r\n\r\nAs for specifying the worker group as a local - yep, first thing I tried 😄 \r\n\r\nThe solution I'm trying locally right now is to add a `worker_group_count` variable that needs to be manually specified by the user & have those three locations refer to it instead. Not pretty (and not backwards compatible) but it seems to work"}}
{"actor":{"display_login":"laverya"}}