首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Terraform在Composer GKE集群中创建Kubernetes密钥

使用Terraform在Composer GKE集群中创建Kubernetes密钥
EN

Stack Overflow用户
提问于 2020-05-05 23:16:01
回答 1查看 127关注 0票数 0

有没有办法向GCP上的Composer环境的GKE集群提供密钥?或者更准确地说,定义一个基于google_composer_environment的Kubernetes提供程序

我希望下面的代码能起作用:

代码语言:javascript
复制
resource "google_composer_environment" "job-scheduler" {
    provider = google-beta
    name = "job-scheduler"
    region = var.region

    config {
        ...
    }
}

provider "kubernetes" {
  host = google_composer_environment.job-scheduler.config.0.gke_cluster.endpoint
  client_certificate = base64decode(google_composer_environment.job-scheduler.config.0.gke_cluster.master_auth.0.client_certificate)
  client_key = base64decode(google_composer_environment.job-scheduler.config.0.gke_cluster.master_auth.0.client_key)
  cluster_ca_certificate = base64decode(google_composer_environment.job-scheduler.config.0.gke_cluster.master_auth.0.cluster_ca_certificate)
}

resource "kubernetes_secret" "sa-credentials" {
  metadata {
    name = "sa-credentials"
  }

  data = {
    "secret" = "${file("${var.service_account_credentials_path}")}"
  }
}

但是我得到了以下错误:

代码语言:javascript
复制
Error: Unsupported attribute

  on main.tf line 53, in provider "kubernetes":
  53:   host = google_composer_environment.job-scheduler.config.0.gke_cluster.endpoint

This value does not have any attributes.


Error: Unsupported attribute

  on main.tf line 54, in provider "kubernetes":
  54:   client_certificate = base64decode(google_composer_environment.job-scheduler.config.0.gke_cluster.master_auth.0.client_certificate)

This value does not have any attributes.


Error: Unsupported attribute

  on main.tf line 55, in provider "kubernetes":
  55:   client_key = base64decode(google_composer_environment.job-scheduler.config.0.gke_cluster.master_auth.0.client_key)

This value does not have any attributes.


Error: Unsupported attribute

  on main.tf line 56, in provider "kubernetes":
  56:   cluster_ca_certificate = base64decode(google_composer_environment.job-scheduler.config.0.gke_cluster.master_auth.0.cluster_ca_certificate)

This value does not have any attributes.

任何线索都将不胜感激。干杯!

EN

回答 1

Stack Overflow用户

发布于 2021-02-01 22:02:43

对于仍然想知道gke_cluster是一个字符串的人来说

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61616552

复制
相关文章

相似问题

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