Cluster Labels Disabled

  • Query id: 65c1bc7a-4835-4ac4-a2b6-13d310b0648d
  • Query name: Cluster Labels Disabled
  • Platform: Terraform
  • Severity: Low
  • Category: Insecure Configurations
  • URL: Github

Description

Kubernetes Clusters must be configured with labels, which means the attribute 'resource_labels' must be defined
Documentation

Code samples

Code samples with security vulnerabilities

Positive test num. 1 - tf file
#this is a problematic code where the query should report a result(s)
resource "google_container_cluster" "positive1" {
  name               = "marcellus-wallace"
  location           = "us-central1-a"
  initial_node_count = 3

  timeouts {
    create = "30m"
    update = "40m"
  }
}

Code samples without security vulnerabilities

Negative test num. 1 - tf file
#this code is a correct code for which the query should not find any result
resource "google_container_cluster" "negative1" {
  name               = "marcellus-wallace"
  location           = "us-central1-a"
  initial_node_count = 3

  resource_labels {

  }

  timeouts {
    create = "30m"
    update = "40m"
  }
}