【问题标题】:Error: Invalid multi-line string terraform错误:无效的多行字符串 terraform
【发布时间】:2021-07-28 16:51:30
【问题描述】:

我正在尝试定义资源,但 Terraform 抱怨

resource "aws_cloudwatch_event_target" "my-functions-order-machine-completion-target" {
  target_id = "some target id"
  rule      = aws_cloudwatch_event_rule.my-functions-order-machine-completion-rule.name
  arn       = module.lambda["myLambda"].function_arn
}

错误

Quoted strings may not be split over multiple lines. To produce a multi-line
string, either use the \n escape to represent a newline character or use the
"heredoc" multi-line template syntax.

我看到Heredoc Strings,但不知道如何在“资源”之后使用它

【问题讨论】:

  • aws_cloudwatch_event_rule.my-functions-order-machine-completion-rule之后应该有一个.name
  • 是的,抱歉打错了
  • 错误信息与显示的代码无关。你想做什么,在哪里,发生了什么错误,到底在哪里!?
  • 在 TF 运行时基本上更新了格式,它抱怨字符串不能分成多行

标签: terraform


【解决方案1】:

虽然不是一个很好的答案,但缩短资源名称为我解决了问题。

我也尝试过类似这样的插值语法,但不起作用:

资源“资源”“${var.name}”

【讨论】:

    猜你喜欢
    • 2021-11-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-05-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-13
    相关资源
    最近更新 更多