我正在尝试将以下ConfigMap
yaml文件(link here)转换为kubernetes_config_map
,但是在尝试定义它时遇到语法错误。
尤其是,我无法绕过opentsdb.conf
文件中的点符号
apiVersion: v1
kind: ConfigMap
metadata:
name: opentsdb-config
data:
opentsdb.conf: |
google.bigtable.project.id = REPLACE_WITH_PROJECT
google.bigtable.instance.id = REPLACE_WITH_INSTANCE
google.bigtable.zone.id = REPLACE_WITH_ZONE
hbase.client.connection.impl = com.google.cloud.bigtable.hbase1_2.BigtableConnection
google.bigtable.auth.service.account.enable = true
tsd.network.port = 4242
tsd.core.auto_create_metrics = true
tsd.core.meta.enable_realtime_ts = true
tsd.core.meta.enable_realtime_uid = true
tsd.core.meta.enable_tsuid_tracking = true
tsd.http.request.enable_chunked = true
tsd.http.request.max_chunk = 131072
tsd.storage.fix_duplicates = true
tsd.storage.enable_compaction = false
tsd.storage.max_tags = 12
tsd.http.staticroot = /opentsdb/build/staticroot
tsd.http.cachedir = /tmp/opentsdb
这是我目前在"opentsdb.conf"
上犯错的尝试
resource "kubernetes_config_map" "opentsdb" {
metadata {
name = "opentsdb-config",
namespace = "dev"
}
data {
"opentsdb.conf" = {
google.bigtable.project.id = var.project_id,
google.bigtable.instance.id = google_bigtable_instance.development-instance.name,
google.bigtable.zone.id = var.zone,
hbase.client.connection.impl = "com.google.cloud.bigtable.hbase1_2.BigtableConnection",
google.bigtable.auth.service.account.enable = true
tsd.network.port = 4242
tsd.core.auto_create_metrics = true
tsd.core.meta.enable_realtime_ts = true
tsd.core.meta.enable_realtime_uid = true
tsd.core.meta.enable_tsuid_tracking = true
tsd.http.request.enable_chunked = true
tsd.http.request.max_chunk = 131072
tsd.storage.fix_duplicates = true
tsd.storage.enable_compaction = false
tsd.storage.max_tags = 12
tsd.http.staticroot = "/opentsdb/build/staticroot"
tsd.http.cachedir = "/tmp/opentsdb"
}
}
}
答案 0 :(得分:0)
欢迎文件 欢迎文件 正如ydaetskcoR已经提到的那样,您应该修复Terraform语法并添加引号。
这里是Terraform中Configuration Syntax的链接。
块是其他内容的容器:
resource "aws_instance" "example" {
ami = "abc123"
network_interface {
# ...
}
}
块的类型为 (在此示例中为
resource
)。每种块类型定义了type关键字之后必须包含多少 label 个标签。resource
块类型需要两个标签,在上面的示例中分别为aws_instance
和example
。特定的块类型可以具有任意数量的必需标签,或者与嵌套的network_interface
块类型一样,可以不需要任何标签。
答案 1 :(得分:0)
我遇到的问题是我试图将一个对象分配给字符串文字。
我需要使用EOF
语法,如下所示:
resource "kubernetes_config_map" "opentsdb" {
metadata {
name = "opentsdb-config"
namespace = "dev"
}
data = {
"opentsdb.conf" = <<EOF
google.bigtable.project.id = ${var.project_id}
google.bigtable.instance.id = ${var.bigtable_instance_id}
google.bigtable.zone.id = ${var.zone}
hbase.client.connection.impl = com.google.cloud.bigtable.hbase1_2.BigtableConnection
google.bigtable.auth.service.account.enable = true
tsd.network.port = 4242
tsd.core.auto_create_metrics = true
tsd.core.meta.enable_realtime_ts = true
tsd.core.meta.enable_realtime_uid = true
tsd.core.meta.enable_tsuid_tracking = true
tsd.http.request.enable_chunked = true
tsd.http.request.max_chunk = 131072
tsd.storage.fix_duplicates = true
tsd.storage.enable_compaction = false
tsd.storage.max_tags = 12
tsd.http.staticroot = /opentsdb/build/staticroot
tsd.http.cachedir = /tmp/opentsdb
EOF
}
}