/terraform-aws-msk-cluster

Terraform module to provision an AWS MSK Cluster.

Primary LanguageHCLApache License 2.0Apache-2.0

Geek Cell GmbH

Code Quality

License GitHub release (latest tag) Release Validate Lint

Terraform AWS MSK Cluster Module

Terraform module which creates a MSK Cluster. The focus on this module lies within it's simplicity by providing default values that should make sense for most use cases.

Inputs

Name Description Type Default Required
client_subnets A list of subnets to connect to in client VPC. list(string) n/a yes
cluster_name Name of the MSK cluster. string n/a yes
enable_appautoscaling Enable or disable MSK App Autoscaling. bool false no
instance_type Specify the instance type to use for the kafka brokers. string n/a yes
kafka_version Specify the desired Kafka software version. string n/a yes
number_of_broker_nodes The desired total number of broker nodes in the kafka cluster. number 3 no
security_groups A list of the security groups to associate with the elastic network interfaces to control who can communicate with the cluster. list(string) n/a yes
tags Tags to add to the AWS Customer Managed Key. map(any) {} no
volume_size The size in GiB of the EBS volume for the data drive on each broker node. number n/a yes

Outputs

Name Description
bootstrap_brokers_tls One or more DNS names (or IP addresses) and TLS port pairs.
zookeeper_connect_string A comma separated list of one or more hostname:port pairs to use to connect to the Apache Zookeeper cluster.

Providers

Name Version
aws >= 4.4

Resources

  • resource.aws_msk_cluster.main (main.tf#7)

Examples

Basic Example

module "basic-example" {
  source          = "../../"
  client_subnets  = ["subnet-12345678", "subnet-87654321"]
  cluster_name    = "cluster1"
  instance_type   = "kafka.t3.small"
  kafka_version   = "3.2.0"
  security_groups = ["sg-12345678"]
  volume_size     = 10
}

With Autoscaling

module "with-autoscaling" {
  source          = "../../"
  client_subnets  = ["subnet-12345678", "subnet-87654321"]
  cluster_name    = "cluster1"
  instance_type   = "kafka.t3.small"
  kafka_version   = "3.2.0"
  security_groups = ["sg-12345678"]
  volume_size     = 10

  enable_appautoscaling = true
}