首页 > 解决方案 > Terraform 从 0.11 升级到 0.12 出现错误连接函数中“lists”参数的值无效

问题描述

我正在将我们的代码从Terraform 0.11升级到0.12.29

我在 TF 0.11 上运行的旧代码

我的.tf

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

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

其中abc定义为:

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

将 my.tf更新为 TF 0.12.29 的以下内容

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

但我收到此错误:

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.

我还看到了这篇文章:https ://github.com/hashicorp/terraform/issues/20705建议使用concatflatten但我无法使其工作。我是 terraform 的新手,所以这可能是一个简单的问题,但我无法使其正常工作。

标签: amazon-web-servicesmigrationterraformterraform-provider-awsiaas

解决方案


推荐阅读