EKS cluster logging is not enabled

  • Query id: 37304d3f-f852-40b8-ae3f-725e87a7cedf
  • Query name: EKS cluster logging is not enabled
  • Platform: Terraform
  • Severity: Low
  • Category: Observability
  • URL: Github

Description

Amazon EKS control plane logging is not enabled
Documentation

Code samples

Code samples with security vulnerabilities

Positive test num. 1 - tf file
variable "cluster_name" {
  default = "example"
  type    = string
}

resource "aws_eks_cluster" "positive1" {
  depends_on = [aws_cloudwatch_log_group.example]
  name                      = var.cluster_name
}

Code samples without security vulnerabilities

Negative test num. 1 - tf file
variable "cluster_name" {
  default = "example"
  type    = string
}

resource "aws_eks_cluster" "negative1" {
  depends_on = [aws_cloudwatch_log_group.example]

  enabled_cluster_log_types = ["api", "audit", "authenticator", "controllerManager", "scheduler"]
  name                      = var.cluster_name
}