2

我正在尝试使用带有内联命令的 remote-exec 配置程序来安装和配置 datadog_agent。以下 echo 行运行良好,并且似乎被正确引用/转义。我似乎无法在 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\"",
                   .
    ]
}

我以为是*,并在尝试逃跑失败后将其取出。我认为 * 很好(红鲱鱼)。

4

0 回答 0