如何在terraform中指定模板文件的路径

问题描述

我有一个 json 文件,它定义了 stepfunction 状态机,然后在 terraform 中我想使用 templatefiile(),当前文件夹结构是:

terraform folder -> terraform file (e.g: step-function.tf file) & json file (e.g: step-function.json)

在 step-function.tf 文件中:

deFinition = templatefile("step-function.json",{
      xxxxxxx
    }
)

这会给我错误

Invalid value for "path" parameter: no file exists at
step-function.json; this function works only with files
that are distributed as part of the configuration source code,so if this file
will be created by a resource in this configuration you must instead obtain
this result from an attribute of that resource.

我不完全明白为什么,我如何修改这个路径,当我在本地测试这个 terraform 脚本时,如果我使用 templatefile("../../xxx/xxx/terraform/step-function,json") 它会工作,但我不想使用这个表达式,如何我可以修改吗?非常感谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)