Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Terraform module to create AWS MSK (Managed Streaming for Kafka) resources 🇺🇦

License

NotificationsYou must be signed in to change notification settings

terraform-aws-modules/terraform-aws-msk-kafka-cluster

Terraform module which creates AWS MSK (Managed Streaming for Kafka) resources.

SWUbanner

Usage

Seeexamples directory for working examples to reference:

module"msk_kafka_cluster" {source="terraform-aws-modules/msk-kafka-cluster/aws"name=local.namekafka_version="3.5.1"number_of_broker_nodes=3enhanced_monitoring="PER_TOPIC_PER_PARTITION"broker_node_client_subnets=["subnet-12345678","subnet-024681012","subnet-87654321"]broker_node_storage_info={    ebs_storage_info= { volume_size=100 }  }broker_node_instance_type="kafka.t3.small"broker_node_security_groups=["sg-12345678"]encryption_in_transit_client_broker="TLS"encryption_in_transit_in_cluster=trueconfiguration_name="example-configuration"configuration_description="Example configuration"configuration_server_properties={"auto.create.topics.enable"=true"delete.topic.enable"=true  }jmx_exporter_enabled=truenode_exporter_enabled=truecloudwatch_logs_enabled=trues3_logs_enabled=trues3_logs_bucket="aws-msk-kafka-cluster-logs"s3_logs_prefix=local.namescaling_max_capacity=512scaling_target_value=80client_authentication={    sasl= { scram=true }  }create_scram_secret_association=truescram_secret_association_secret_arn_list=[aws_secretsmanager_secret.one.arn,aws_secretsmanager_secret.two.arn,  ]# AWS Glue Registryschema_registries={    team_a= {      name="team_a"      description="Schema registry for Team A"    }    team_b= {      name="team_b"      description="Schema registry for Team B"    }  }# AWS Glue Schemasschemas={    team_a_tweets= {      schema_registry_name="team_a"      schema_name="tweets"      description="Schema that contains all the tweets"      compatibility="FORWARD"      schema_definition="{\"type\":\"record\",\"name\":\"r1\",\"fields\": [ {\"name\":\"f1\",\"type\":\"int\"}, {\"name\":\"f2\",\"type\":\"string\"} ]}"      tags= { Team="Team A" }    }    team_b_records= {      schema_registry_name="team_b"      schema_name="records"      description="Schema that contains all the records"      compatibility="FORWARD"      team_b_records= {        schema_registry_name="team_b"        schema_name="records"        description="Schema that contains all the records"        compatibility="FORWARD"        schema_definition=jsonencode({          type="record"          name="r1"          fields= [            {              name="f1"              type="int"            },            {              name="f2"              type="string"            },            {              name="f3"              type="boolean"            }          ]        })        tags= { Team="Team B" }      }    }  }tags={    Terraform="true"    Environment="dev"  }}

Examples

Examples codified under theexamples are intended to give users references for how to use the module(s) as well as testing/validating changes to the source code of the module. If contributing to the project, please be sure to make any appropriate updates to the relevant examples to allow maintainers to test your changes and to keep the examples up to date for users. Thank you!

Requirements

NameVersion
terraform>= 1.5.7
aws>= 6.22.1
random>= 3.6

Providers

NameVersion
aws>= 6.22.1
random>= 3.6

Modules

No modules.

Resources

NameType
aws_appautoscaling_policy.thisresource
aws_appautoscaling_target.thisresource
aws_cloudwatch_log_group.thisresource
aws_glue_registry.thisresource
aws_glue_schema.thisresource
aws_msk_cluster.thisresource
aws_msk_cluster_policy.thisresource
aws_msk_configuration.thisresource
aws_msk_scram_secret_association.thisresource
aws_msk_vpc_connection.thisresource
aws_mskconnect_custom_plugin.thisresource
aws_mskconnect_worker_configuration.thisresource
random_id.thisresource
aws_iam_policy_document.thisdata source

Inputs

NameDescriptionTypeDefaultRequired
broker_node_az_distributionThe distribution of broker nodes across availability zones (documentation). Currently the only valid value isDEFAULTstringnullno
broker_node_client_subnetsA list of subnets to connect to in client VPC (documentation)list(string)[]no
broker_node_connectivity_infoInformation about the cluster access configuration
object({
vpc_connectivity = optional(object({
client_authentication = optional(object({
sasl = optional(object({
iam = optional(bool)
scram = optional(bool)
}))
tls = optional(bool)
}))
}))
public_access = optional(object({
type = optional(string)
}))
})
nullno
broker_node_instance_typeSpecify the instance type to use for the kafka brokers. e.g. kafka.m5.large. (Pricing info)stringnullno
broker_node_security_groupsA list of the security groups to associate with the elastic network interfaces to control who can communicate with the clusterlist(string)[]no
broker_node_storage_infoA block that contains information about storage volumes attached to MSK broker nodes
object({
ebs_storage_info = optional(object({
provisioned_throughput = optional(object({
enabled = optional(bool)
volume_throughput = optional(number)
}))
volume_size = optional(number, 64)
}))
})
nullno
client_authenticationConfiguration block for specifying a client authentication
object({
sasl = optional(object({
iam = optional(bool)
scram = optional(bool)
}))
tls = optional(object({
certificate_authority_arns = optional(list(string))
}))
unauthenticated = optional(bool)
})
nullno
cloudwatch_log_group_classSpecifies the log class of the log group. Possible values are: STANDARD or INFREQUENT_ACCESS.stringnullno
cloudwatch_log_group_kms_key_idThe ARN of the KMS Key to use when encrypting log datastringnullno
cloudwatch_log_group_nameName of the Cloudwatch Log Group to deliver logs tostringnullno
cloudwatch_log_group_retention_in_daysSpecifies the number of days you want to retain log events in the log groupnumber0no
cloudwatch_logs_enabledIndicates whether you want to enable or disable streaming broker logs to Cloudwatch Logsboolfalseno
cluster_override_policy_documentsOverride policy documents for cluster policylist(string)nullno
cluster_policy_statementsMap of policy statements for cluster policy
map(object({
sid = optional(string)
actions = optional(list(string))
not_actions = optional(list(string))
effect = optional(string)
resources = optional(list(string))
not_resources = optional(list(string))
principals = optional(list(object({
type = string
identifiers = list(string)
})))
not_principals = optional(list(object({
type = string
identifiers = list(string)
})))
condition = optional(list(object({
test = string
values = list(string)
variable = string
})))
}))
nullno
cluster_source_policy_documentsSource policy documents for cluster policylist(string)nullno
configuration_arnARN of an externally created configuration to usestringnullno
configuration_descriptionDescription of the configurationstringnullno
configuration_nameName of the configurationstringnullno
configuration_revisionRevision of the externally created configuration to usenumbernullno
configuration_server_propertiesContents of the server.properties file. Supported properties are documented in theMSK Developer Guidemap(string){}no
connect_custom_pluginsMap of custom plugin configuration details (map of maps)
map(object({
name = string
description = optional(string)
content_type = string
s3_bucket_arn = string
s3_file_key = string
s3_object_version = optional(string)
timeouts = optional(object({
create = optional(string)
delete = optional(string)
}))
}))
{}no
connect_worker_config_descriptionA summary description of the worker configurationstringnullno
connect_worker_config_nameThe name of the worker configurationstringnullno
connect_worker_config_properties_file_contentContents of connect-distributed.properties file. The value can be either base64 encoded or in raw formatstringnullno
createDetermines whether cluster resources will be createdbooltrueno
create_cloudwatch_log_groupDetermines whether to create a CloudWatch log groupbooltrueno
create_cluster_policyDetermines whether to create an MSK cluster policyboolfalseno
create_configurationDetermines whether to create a configurationbooltrueno
create_connect_worker_configurationDetermines whether to create connect worker configurationboolfalseno
create_schema_registryDetermines whether to create a Glue schema registry for managing Avro schemas for the clusterbooltrueno
create_scram_secret_associationDetermines whether to create SASL/SCRAM secret associationboolfalseno
enable_storage_autoscalingDetermines whether autoscaling is enabled for storagebooltrueno
encryption_at_rest_kms_key_arnYou may specify a KMS key short ID or ARN (it will always output an ARN) to use for encrypting your data at rest. If no key is specified, an AWS managed KMS ('aws/msk' managed service) key will be used for encrypting the data at reststringnullno
encryption_in_transit_client_brokerEncryption setting for data in transit between clients and brokers. Valid values:TLS,TLS_PLAINTEXT, andPLAINTEXT. Default value isTLSstringnullno
encryption_in_transit_in_clusterWhether data communication among broker nodes is encrypted. Default value:trueboolnullno
enhanced_monitoringSpecify the desired enhanced MSK CloudWatch monitoring level. SeeMonitoring Amazon MSK with Amazon CloudWatchstringnullno
firehose_delivery_streamName of the Kinesis Data Firehose delivery stream to deliver logs tostringnullno
firehose_logs_enabledIndicates whether you want to enable or disable streaming broker logs to Kinesis Data Firehoseboolfalseno
jmx_exporter_enabledIndicates whether you want to enable or disable the JMX Exporterboolfalseno
kafka_versionSpecify the desired Kafka software versionstringnullno
nameName of the MSK clusterstring"msk"no
node_exporter_enabledIndicates whether you want to enable or disable the Node Exporterboolfalseno
number_of_broker_nodesThe desired total number of broker nodes in the kafka cluster. It must be a multiple of the number of specified client subnetsnumbernullno
rebalancingConfiguration block for intelligent rebalancing
object({
status = string
})
nullno
regionRegion where this resource will be managed. Defaults to the Region set in the provider configurationstringnullno
s3_logs_bucketName of the S3 bucket to deliver logs tostringnullno
s3_logs_enabledIndicates whether you want to enable or disable streaming broker logs to S3boolfalseno
s3_logs_prefixPrefix to append to the folder namestringnullno
scaling_max_capacityMax storage capacity for Kafka broker autoscalingnumber250no
scaling_role_arnThe ARN of the IAM role that allows Application AutoScaling to modify your scalable target on your behalf. This defaults to an IAM Service-Linked Rolestringnullno
scaling_target_valueThe Kafka broker storage utilization at which scaling is initiatednumber70no
schema_registriesA map of schema registries to be created
map(object({
name = string
description = optional(string)
tags = optional(map(string), {})
}))
{}no
schemasA map schemas to be created within the schema registry
map(object({
schema_name = string
schema_registry_name = string
description = optional(string)
data_format = optional(string, "AVRO")
compatibility = string
schema_definition = string
tags = optional(map(string), {})
}))
{}no
scram_secret_association_secret_arn_listList of AWS Secrets Manager secret ARNs to associate with SCRAMlist(string)[]no
storage_modeControls storage mode for supported storage tiers. Valid values are:LOCAL orTIEREDstringnullno
tagsA map of tags to assign to the resources createdmap(string){}no
timeoutsCreate, update, and delete timeout configurations for the cluster
object({
create = optional(string)
update = optional(string)
delete = optional(string)
})
nullno
vpc_connectionsMap of VPC Connections to create
map(object({
authentication = string
client_subnets = list(string)
security_groups = list(string)
vpc_id = string
tags = optional(map(string), {})
}))
{}no

Outputs

NameDescription
appautoscaling_policy_arnThe ARN assigned by AWS to the scaling policy
appautoscaling_policy_nameThe scaling policy's name
appautoscaling_policy_policy_typeThe scaling policy's type
arnAmazon Resource Name (ARN) of the MSK cluster
bootstrap_brokersComma separated list of one or more hostname:port pairs of Kafka brokers suitable to bootstrap connectivity to the Kafka cluster
bootstrap_brokers_plaintextComma separated list of one or more hostname:port pairs of Kafka brokers suitable to bootstrap connectivity to the Kafka cluster. Contains a value ifencryption_in_transit_client_broker is set toPLAINTEXT orTLS_PLAINTEXT
bootstrap_brokers_publicComma separated list of one or more hostname:port pairs of Kafka brokers suitable to bootstrap connectivity to the Kafka cluster
bootstrap_brokers_public_sasl_iamOne or more DNS names (or IP addresses) and SASL IAM port pairs
bootstrap_brokers_public_sasl_scramOne or more DNS names (or IP addresses) and SASL SCRAM port pairs
bootstrap_brokers_public_tlsOne or more DNS names (or IP addresses) and TLS port pairs
bootstrap_brokers_sasl_iamOne or more DNS names (or IP addresses) and SASL IAM port pairs. This attribute will have a value ifencryption_in_transit_client_broker is set toTLS_PLAINTEXT orTLS andclient_authentication_sasl_iam is set totrue
bootstrap_brokers_sasl_scramOne or more DNS names (or IP addresses) and SASL SCRAM port pairs. This attribute will have a value ifencryption_in_transit_client_broker is set toTLS_PLAINTEXT orTLS andclient_authentication_sasl_scram is set totrue
bootstrap_brokers_tlsOne or more DNS names (or IP addresses) and TLS port pairs. This attribute will have a value ifencryption_in_transit_client_broker is set toTLS_PLAINTEXT orTLS
bootstrap_brokers_vpc_connectivityComma separated list of one or more hostname:port pairs of Kafka brokers suitable to bootstrap connectivity to the Kafka cluster
bootstrap_brokers_vpc_connectivity_sasl_iamOne or more DNS names (or IP addresses) and SASL IAM port pairs for VPC connectivity
bootstrap_brokers_vpc_connectivity_sasl_scramOne or more DNS names (or IP addresses) and SASL SCRAM port pairs for VPC connectivity
bootstrap_brokers_vpc_connectivity_tlsOne or more DNS names (or IP addresses) and TLS port pairs for VPC connectivity
cluster_nameName of the MSK cluster
cluster_uuidUUID of the MSK cluster, for use in IAM policies
configuration_arnAmazon Resource Name (ARN) of the configuration
configuration_latest_revisionLatest revision of the configuration
connect_custom_pluginsA map of output attributes for the connect custom plugins created
connect_worker_configuration_arnThe Amazon Resource Name (ARN) of the worker configuration
connect_worker_configuration_latest_revisionAn ID of the latest successfully created revision of the worker configuration
current_versionCurrent version of the MSK Cluster used for updates, e.g.K13V1IB3VIYZZH
log_group_arnThe Amazon Resource Name (ARN) specifying the log group
schema_registriesA map of output attributes for the schema registries created
schemasA map of output attributes for the schemas created
scram_secret_association_idAmazon Resource Name (ARN) of the MSK cluster
vpc_connectionsA map of output attributes for the VPC connections created
zookeeper_connect_stringA comma separated list of one or more hostname:port pairs to use to connect to the Apache Zookeeper cluster. The returned values are sorted alphabetically
zookeeper_connect_string_tlsA comma separated list of one or more hostname:port pairs to use to connect to the Apache Zookeeper cluster via TLS. The returned values are sorted alphabetically

License

Apache-2.0 Licensed. SeeLICENSE.

About

Terraform module to create AWS MSK (Managed Streaming for Kafka) resources 🇺🇦

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project

  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp