Terraform upgrade from 0.11 to 0.12 getting error Invalid value for "lists" parameter in join function

Viewed 1757

I am upgrading our code from Terraform 0.11 to 0.12.29.

my older code that works on TF 0.11

my.tf:

data "templ_file" "dep" {
    template = "$${input}"

    vars {
        input = "${join(",", var.abc)}"
    }
}

Where abc is defined as:

variable "abc" {
    default = []
    type = list
}

Updated my.tf to following for TF 0.12.29:

...
vars = {
    input = join(",", var.abc)
}

But I am getting this error:

Error: Invalid function argument

  on ../modules/x/y/my.tf line 6, in data "templ_file" "dep":
   6:         input = join(",", var.abc)
    |----------------
    | var.abc is list of list of dynamic with 1 element

Invalid value for "lists" parameter: incorrect list element type: string
required.

I also saw this post: https://github.com/hashicorp/terraform/issues/20705 which suggest to use concat or flatten but I could not make it work. I am new to terraform so this might be simple question but I am unable to get this working.

0 Answers
Related