Santosh Kumar
Santosh Kumar

Reputation: 791

Terraform Unsupported block error for selector in kubernetes_service resource

Terraform configuration for heapster to deploy on kubernetes cluster is failing with error:

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 configuration is:

resource "kubernetes_service" "service"{
    metadata {
        name="monitoring-influxdb"
        namespace="kube-system"
    }

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

        port{
            port=8086
            target_port=8086
        }
    }
}

Upvotes: 3

Views: 2821

Answers (2)

Mike Bauer
Mike Bauer

Reputation: 41

Had this same issue. Note the = and the error message If so, use the equals sign to assign it a value..

Simple fix:

selector = {
    k8s-app="influxdb"
}

Upvotes: 3

Mithilesh_Kunal
Mithilesh_Kunal

Reputation: 929

Your configuration file worked well with Terraform v0.11. Upon updating Terraform version and retrying it with version 0.12, it returned in the above error.

So this is a bug in Terraform v0.12

Upvotes: 2

Related Questions