在 kubernetes 集群上部署 heapster 的 Terraform 配置失败并出现错误:

Blocks of type "selector" are not expected here. Did you mean to define
argument "selector"? If so, use the equals sign to assign it a value.

资源配置为:
resource "kubernetes_service" "service"{
    metadata {
        name="monitoring-influxdb"
        namespace="kube-system"
    }

    spec {
        selector {
            k8s-app="influxdb"
        }

        port{
            port=8086
            target_port=8086
        }
    }
}

最佳答案

有同样的问题。请注意 = 和错误消息 If so, use the equals sign to assign it a value.

简单的修复:

selector = {
    k8s-app="influxdb"
}

关于kubernetes_service 资源中选择器的 Terraform Unsupported block 错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/56696706/

10-16 10:13