Skip to content

MSK clusters should have public access disabled

This control checks whether public access is disabled for an Amazon MSK cluster. The control fails if public access is enabled for the MSK cluster.

How to fix

Attribute broker_node_group_info[0].connectivity_info[0].public_access[0].type of aws_msk_cluster must be "DISABLED".

Implementation options

Choose the option that matches how you manage Terraform. All options satisfy this control.

Option 1: Open source module (terraform-aws-modules)

If you use terraform-aws-modules/msk-kafka-cluster/aws, configure the required module inputs to satisfy this control. You can later migrate to the compliance.tf module with minimal changes because it is compatible by design.

module "msk_kafka_cluster" {
  source  = "terraform-aws-modules/msk-kafka-cluster/aws"
  version = ">=3.0.0"

  broker_node_client_subnets  = ["subnet-abc123", "subnet-def456"]
  broker_node_instance_type   = "kafka.t3.small"
  broker_node_security_groups = ["sg-abc12345"]
  kafka_version               = "3.6.0"
  name                        = "abc123"
  number_of_broker_nodes      = 3

  broker_node_connectivity_info = {
    public_access = {
      type = "DISABLED"
    }
  }
}

Option 2: Terraform AWS provider resources

If you manage resources directly, configure the relevant Terraform AWS provider resources to meet this control. See docs for the resources involved: aws_msk_cluster.

resource "aws_msk_cluster" "this" {
  cluster_name           = "pofix-example-cluster"
  kafka_version          = "3.5.1"
  number_of_broker_nodes = 1

  broker_node_group_info {
    client_subnets = [element(["subnet-abc123", "subnet-def456"], 0)]

    connectivity_info {
      public_access {
        type = "DISABLED"
      }
    }

    instance_type   = "kafka.m5.large"
    security_groups = ["sg-abc12345"]
  }
}
Which option should I choose?
  • Compliance.tf module (recommended): controls enforced by default and mapped to frameworks.
  • Open source module (terraform-aws-modules): compatible by design with compliance.tf. Same variable names for an easy, low-change migration path when you are ready.
  • Terraform AWS provider resources: manage Terraform resources directly.

Tool mappings

Use these identifiers to cross-reference this control across tools, reports, and evidence.

  • Compliance.tf (CTF) Control: msk_cluster_not_publicly_accessible

  • AWS Config Managed Rule: MSK_CLUSTER_PUBLIC_ACCESS_DISABLED

  • Powerpipe Control: aws_compliance.control.msk_cluster_not_publicly_accessible