我正在尝试使用带有内联命令的remote-exec配置程序来安装和配置datadog_agent。以下回声线运行正常,似乎正确引用/转义。我似乎无法在sed线上获得引用/转义权。当它取消注释时,似乎整个内联脚本都没有运行。
provisioner "remote-exec" {
inline = [
.
# This line runs just fine
"sudo sh -c \"echo 'deb https://apt.datadoghq.com/ stable main' > /etc/apt/sources.list.d/datadog.list\"",
.
# This line causes the entire inline not to run
"sudo sh -c \"sed 's/api_key:.*/api_key: ${dd_api_key}' /etc/dd-agent/datadog.conf.example > /etc/dd-agent/datadog.conf\"",
.
]
}
我认为这是*并且在失败尝试失败后将其取出。我认为*很好(红鲱鱼)。