我正在尝试使用 terraform 模板语法检查模板文件中是否存在变量,但我收到错误消息This object does not have an attribute named "proxy_set_header
。
$ cat nginx.conf.tmpl
%{ for location in jsondecode(locations) }
location ${location.path} {
%{ if location.proxy_set_header }
proxy_set_header ${location.proxy_set_header};
%{ endif }
}
%{ endfor }
我尝试了成功if location.proxy_set_header != ""
和if location.proxy_set_header
失败。
如何使用字符串模板检查变量是否存在?