【发布时间】:2018-08-23 03:14:17
【问题描述】:
我正在尝试在使用 Terraform 创建实例后创建 Filebeat 配置文件:
resource "local_file" "greylogIP" {
content = <<EOF
filebeat.inputs:
- type: log
enabled: false
paths:
- /var/log/*.log
filebeat.config.modules:
path: '$'{path.config}/modules.d/*.yml
reload.enabled: false
setup.template.settings:
index.number_of_shards: 3
output.logstash:
hosts: ["${aws_instance.web.public_ip}:5014"]
EOF
filename = "filebeat.conf"
}
我需要传递 ${aws_instance.web.public_ip} 变量来分配动态 IP,但 Terraform 也尝试插入 path: '$'{path.config}/modules.d/*.yml,这是 Filebeat 配置的一部分并引发错误。
如何将path: '$'{path.config}/modules.d/*.yml 作为字符串传递?
【问题讨论】: