Ask questionsError: Invalid template interpolation value
Hello everyone. Till today I was using an older version of terraform, but today I upgraded it to the latest available version: ``Terraform v0.12.4
After that terraform plan is failing with following error:
Error: Invalid template interpolation value
on eks.tf line 149, in resource "aws_eks_cluster" "xxx-eks":
149: subnet_ids = ["${aws_subnet.eks-public.*.id}, ${aws_subnet.eks-private.*.id}"]
|----------------
| aws_subnet.eks-public is tuple with 3 elements
Cannot include the given value in a string template: string required.
Error: Invalid template interpolation value
on eks.tf line 149, in resource "aws_eks_cluster" "xxx-eks":
149: subnet_ids = ["${aws_subnet.eks-public.*.id}, ${aws_subnet.eks-private.*.id}"]
|----------------
| aws_subnet.eks-private is tuple with 3 elements
Cannot include the given value in a string template: string required.
I can't understand what is going on, moreover that it was working before update. Here you can find piece of code which makes the problem:
resource "aws_eks_cluster" "xxx-eks" {
name = var.cluster-name
role_arn = aws_iam_role.eks-cluster.arn
version = "1.12"
vpc_config {
security_group_ids = [aws_security_group.eks-cluster.id]
subnet_ids = ["${aws_subnet.eks-public.*.id}, ${aws_subnet.eks-private.*.id}"]
}
depends_on = [
aws_iam_role_policy_attachment.GP-cluster-AmazonEKSClusterPolicy,
aws_iam_role_policy_attachment.GP-cluster-AmazonEKSServicePolicy,
]
}
Please help me to solve this issue.
Answer
questions
AndreiBrajnicov
Hi @apparentlymart . Thank you very much. You solved my day.
Related questions