profile
viewpoint

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

  • provider.aws v2.19.0

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.

hashicorp/terraform

Answer questions AndreiBrajnicov

Hi @apparentlymart . Thank you very much. You solved my day.

useful!

Related questions

failed to save provider manifest: open .terraform/plugins/linux_amd64/lock.json: permission denied hot 4
The argument "host" is required, but no definition was found. hot 3
Unable to run 0.12upgrade hot 3
Module cannot find alias AWS provider in 0.12.0 hot 3
Terraform v0.11.1 : Error downloading modules: Error loading modules: open .terraform/modules/3f10921295c292995128e9e36eb: no such file or directory hot 2
MalformedPolicyDocument: Policy document should not specify a principal. hot 2
Error in Terraform 0.12.0: This object has no argument, nested block, or exported attribute hot 2
Feature Request - Allow list/array in 'query' in 'external' data source hot 2
Terraform provider downloads fail with TLS handshake timeout hot 2
'terraform init' failed with 'Registry service unreachable.' error hot 2
for_each attribute for creating multiple resources based on a map hot 2
`Unreadable module directory` error is not clear for nested modules hot 2
Provider Development: Expected type 'string', got unconvertible type '[]interface {}' - with complicated block hot 2
Error loading state: state snapshot was created by Terraform v0.12.7, which is newer than current v0.12.6 hot 2
[BUG] Terraform 0.12.x corrupts state when upgrading from 0.11.14 hot 1
Github User Rank List