如何在 Terraform Cloud 中输入复杂(嵌套)变量?

All*_* Xu 2 terraform

在 Terraform Cloud 中,我们有一个像这样的 Web 用户界面来为变量赋值:

在此输入图像描述

如何在上面的 UI 中输入这样的变量,以便我可以像在 .tfavr 文件中看到的方式正确地查看雇佣体系?

tef_var = {
  nested = {
    key1 = value1
    key2 = value3
    key3 = value4
  }
}
Run Code Online (Sandbox Code Playgroud)

Con*_*gey 7

https://www.terraform.io/docs/cloud/workspaces/variables.html#hcl-values

要输入列表或地图值,请单击变量的“HCL”复选框(编辑时可见),然后使用编写 Terraform 代码时使用的相同 HCL 语法输入值。例如:

{
    us-east-1 = "image-1234"
    us-west-2 = "image-4567"
}
Run Code Online (Sandbox Code Playgroud)

这对我有用。

nested = {
  key1 = "value1"
  key2 = "value3"
  key3 = "value4"
}
Run Code Online (Sandbox Code Playgroud)

terraform云hcl地图变量