terraform - 如何在terraform中多行字符串
问题描述
我正在尝试以下示例
resource "google_logging_metric" "my_metric" {
description = "Check for logs of some cron job\t"
name = "mycj-logs"
filter = "resource.type=\"k8s_container\" AND resource.labels.cluster_name=\"${local.k8s_name}\" AND resource.labels.namespace_name=\"workable\" AND resource.labels.container_name=\"mycontainer-cronjob\" \nresource.labels.pod_name:\"my-pod\""
project = "${data.terraform_remote_state.gke_k8s_env.project_id}"
metric_descriptor {
metric_kind = "DELTA"
value_type = "INT64"
}
}
有没有办法使过滤器字段多行?
解决方案
在 Google 中快速搜索会将您发送到文档:https ://www.terraform.io/docs/language/expressions/strings.html#heredoc-strings
你只需要写一些像
<<EOT
hello
world
EOT
推荐阅读
- android - 手机一段时间未使用时未触发 SMS BroadcastReceiver?
- web-scraping - BeautifulSoup 查找特定字符串
- android - 不允许用户拒绝应用权限
- javascript - 滑块不会自动加载
- android - 即使应用程序关闭,BroadcastReceiver 也能正常工作
- c# - Microsoft Word:Normal.dotm,无法打开现有文件:在 c# 中使用 Microsoft.Office.Interop.Word
- ruby-on-rails - 为什么当我尝试使用用户输入创建一个 Datetime 对象作为参数时说无效日期
- c# - Unity TCP/IP 服务器只接受本地连接。同一台 PC 上的相同代码而不是 Unity 可以正常工作
- ios - NSDictionary 创建错误,某些键没有引号
- r - 在主标题上方放置图例