【发布时间】:2021-09-01 13:27:42
【问题描述】:
在 terraform 中,有没有办法有条件地执行模板文件中的某些代码行?例如:
我有一个 test.sh.tpl 文件,定义如下,从 main.tf 调用
#!/bin/bash echo ${test_key} > /opt/test_key.properties
在上面的值中“test_key”是从变量中赋值的
现在我只想在 ${test_key} 值不为空的情况下执行上述代码。我试过了,但即使值存在也无法正常工作
{ if ${test_key} != "" }
echo ${test_key} > /opt/test_key.properties
{ endif }
【问题讨论】:
标签: terraform terraform-provider-aws