【问题标题】:Terraform output of embedded multiline string joining new lines in output嵌入多行字符串的 Terraform 输出在输出中加入新行
【发布时间】:2020-05-08 13:00:54
【问题描述】:

我正在使用带有此处字符串的资源:

resource "datadog_monitor" "test" {
  name = "test"
  type = "metric alert"

  message = <<EOF
  {{#is_alert}}
  aaaaaaaaa
  {{/is_alert}}

  {{#is_warning}}
  bbbbbbbb
  {{/is_warning}}

  {{#is_recovery}}
  cccccccc
  {{/is_recovery}}
EOF
....

当我运行计划时,它会将所有内容放在一行中

+ resource "datadog_monitor" "test" {
      + evaluation_delay    = 900
      + id                  = (known after apply)
      + include_tags        = true
      + locked              = false
      + message             = "{{#is_alert}}\n aaaaa\n aaaaa\n {{/is_alert}}\n\n  {{#is_warning}}\n    bbbbbbbb\n  {{/is_warning}}\n\n  {{#is_recovery}}\n  cccccccc\n  {{/is_recovery}}\n
      ......

有没有办法让“消息”的输出变成多行而不是全部在一行,这样更容易阅读?

【问题讨论】:

标签: terraform datadog


【解决方案1】:

我知道这是一个老问题,但万一有人在寻找该问题的答案:

使用EOT(嵌入式opentype)而不是EOF(文件结尾)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-23
    • 1970-01-01
    • 2011-11-05
    相关资源
    最近更新 更多