EKS cluster vpc nets and big nesting of variables failing

resource "aws_eks_cluster" "alpha-cluster" {
    name = "${var.ClusterName}"
    role_arn = "${aws_iam_role.lama-eks-master-policy.arn}"
        security_group_ids = ["${aws_security_group.alpha-eks-sg-int.id}", "${aws_security_group.lama-eks-sg-ext.id}"]
        subnet_ids = [["${aws_subnet.alpha-external.*.id}"], ["${aws_subnet.alpha-internal.*.id}"]]

This one returns a Error: Incorrect attribute value type.
Shouls i add a join or sometthing
Any help highly appreciated.

Hi @qubusp!

Unfortunately since you didn’t share the full error message it’shard to be sure exactly what this is referring to, but I’m guessing it’s pointing at the value of the subnet_ids argument, which is defined as being a set of strings but you’ve given it a set of lists of lists of strings.

Here’s a different way to write it that will produce a value of the expected type:

  subnet_ids = concat(

This works because the [*] operator produces a list, and concat concatenates multiple lists to produce a single list. (Terraform can then automatically convert the list into a set as required by subnet_ids.)

I switched over to the new-style splat syntax [*] here rather than the legacy attribute-only splat syntax .*; it doesn’t make any functional difference in this case, but since this is new code we might as well follow the advice in the documentation and switch to the new syntax.