This module manages KMS-encrypted Kafka cluster in AWS Managed Streaming for Apache Kafka.
Once you have a Corewide Solutions Portal account, this one-time action will use your browser session to retrieve credentials:
shellterraform login solutions.corewide.com
Initialize mandatory providers:
Copy and paste into your Terraform configuration and insert the variables:
hclmodule "tf_aws_msk" {
source = "solutions.corewide.com/aws/tf-aws-msk/aws"
version = "~> 1.0.0"
# specify module inputs here or try one of the examples below
...
}
Initialize the setup:
shellterraform init
Corewide DevOps team strictly follows Semantic Versioning
Specification
to
provide our clients with products that have predictable upgrades between versions. We
recommend
pinning
patch versions of our modules using pessimistic
constraint operator (~>) to prevent breaking changes during upgrades.
To get new features during the upgrades (without breaking compatibility), use
~> 1.0 and run
terraform init -upgrade
For the safest setup, use strict pinning with version = "1.0.0"
|
Module
15% off
|
$595
|
| TOTAL | $695 |
| tf-aws-kms-key | $55 |
| tf-aws-security-group | $45 |
This module manages KMS-encrypted Kafka cluster in AWS Managed Streaming for Apache Kafka.
All notable changes to this project are documented here.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
First stable version
Minimal Kafka setup creates a 3-node Kafka cluster with kafka.t3.small instance type, encrypted with module-managed KMS key:
hclmodule "kafka" {
source = "solutions.corewide.com/aws/tf-aws-msk/aws"
version = "~> 1.0"
name_prefix = "foo"
vpc_id = "vpc-0a1b2c3d4e5f6g7h8"
subnet_ids = [
"subnet-0a1b2c3d4e5f6g7h8",
"subnet-1b2c3d4e5f6g7h8i9",
"subnet-2c3d4e5f6g7h8i9j0",
]
}
Custom Kafka setup creates a 4-node Kafka cluster with kafka.m5.large instance type, 50 GB storage size, specified allowed security group, the custom tag set, and enabled encryption with user-managed KMS key:
hclmodule "kafka" {
source = "solutions.corewide.com/aws/tf-aws-msk/aws"
version = "~> 1.0"
name_prefix = "foo"
vpc_id = "vpc-0a1b2c3d4e5f6g7h8"
machine_size = "kafka.m5.large"
node_count = 4
machine_storage_size = 50
allowed_security_group_ids = ["sg-1b2c3d4e5f6g7h8i9"]
subnet_ids = [
"subnet-0a1b2c3d4e5f6g7h8",
"subnet-2c3d4e5f6g7h8i9j0",
]
server_properties = {
"auto.create.topics.enable" = true
"delete.topic.enable" = false
"compression.type" = "producer"
}
kms_encryption = {
mode = "custom"
key_arn = "arn:aws:kms:us-east-1:012345678901:key/a0b1c2d3-a0b1-c2d3-e4f5-0a1b2c3d4e5"
}
tags = {
Environment = "dev"
}
}
| Variable | Description | Type | Default | Required | Sensitive |
|---|---|---|---|---|---|
name_prefix |
Name prefix for the created resources | string |
yes | no | |
subnet_ids |
List of subnet IDs in which MSK cluster can be provisioned in. Each subnet must be located in a different availability zone. Either 2 or 3 subnets must be specified |
list(string) |
yes | no | |
vpc_id |
ID of a VPC to create security group in | string |
yes | no | |
allowed_security_group_ids |
List of security group IDs to allow connections from to the Kafka cluster (re-ordering IDs in the list can cause re-creation of corresponding security group rule) | list(string) |
[] |
no | no |
engine_version |
Kafka engine version. Supported versions are: 3.7, 3.8, and 3.9 |
string |
3.9 |
no | no |
kms_encryption |
KMS Encryption parameters | object |
{} |
no | no |
kms_encryption.key_arn |
ARN of the KMS key (required if mode is custom) |
string |
no | no | |
kms_encryption.mode |
Encryption mode. Possible values are: aws-managed - cluster is encrypted with an AWS managed KMS key; custom - cluster is encrypted with a supplied custom KMS key; module-managed - cluster is encrypted with an automatically created KMS key |
string |
module-managed |
no | no |
machine_size |
Instance type to use for the Kafka broker | string |
kafka.t3.small |
no | no |
machine_storage_size |
Broker node storage size (Gb) | number |
40 |
no | no |
node_count |
Number of broker nodes in the Kafka cluster. Must be a multiple of the number of availability zones in the subnet_ids parameter. For example, for a cluster in 3 subnets, the target number of brokers must be a multiple of 3. If not provided, the number of nodes will be equal to the number of specified subnets |
number |
no | no | |
server_properties |
Parameters to be passed to the server.properties file in key-value format. See the full list of supported properties |
map(any) |
{} |
no | no |
tags |
Tags to attach to cluster resources | map(string) |
{} |
no | no |
| Output | Description | Type | Sensitive |
|---|---|---|---|
cluster |
Kafka cluster resource attributes | resource |
no |
kms_key |
Contains KMS key parameters if the KMS encryption is selected (full data with the KMS key policy is available only for the module-managed KMS encryption mode) |
computed |
no |
security_group |
Security group of the Kafka cluster | attribute |
no |
| Dependency | Version | Kind |
|---|---|---|
terraform |
>= 1.9 |
CLI |
hashicorp/aws |
~> 6.0 |
provider |
tf-aws-kms-key |
~> 2.0 |
module |
tf-aws-security-group |
~> 3.0 |
module |