首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Kubernetes ConfigMap YAML到Terraform Kubernetes

Kubernetes ConfigMap YAML到Terraform Kubernetes
EN

Stack Overflow用户
提问于 2019-07-17 17:43:58
回答 1查看 2.2K关注 0票数 2

我正在尝试将以下ConfigMap yaml文件(link here)转换为kubernetes_config_map,但在尝试定义它时遇到语法错误。

特别是,我无法绕过opentsdb.conf文件中的点符号

代码语言:javascript
复制
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"上出错的尝试

代码语言:javascript
复制
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"
    }
  }
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-07-23 15:54:53

我遇到的问题是,我试图将一个对象赋给一个字符串文字。

我需要按如下方式使用EOF语法:

代码语言:javascript
复制
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
  }
}
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57072974

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档