diff --git a/README.md b/README.md index fd54ef9..85f9ba1 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ module "msk_kafka_cluster" { source = "terraform-aws-modules/msk-kafka-cluster/aws" name = local.name - kafka_version = "3.4.0" + kafka_version = "3.5.1" number_of_broker_nodes = 3 enhanced_monitoring = "PER_TOPIC_PER_PARTITION" @@ -129,12 +129,14 @@ Examples codified under the [`examples`](https://github.com/terraform-aws-module |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | | [aws](#requirement\_aws) | >= 5.21 | +| [random](#requirement\_random) | >= 3.6 | ## Providers | Name | Version | |------|---------| | [aws](#provider\_aws) | >= 5.21 | +| [random](#provider\_random) | >= 3.6 | ## Modules @@ -156,6 +158,7 @@ No modules. | [aws_msk_vpc_connection.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/msk_vpc_connection) | resource | | [aws_mskconnect_custom_plugin.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/mskconnect_custom_plugin) | resource | | [aws_mskconnect_worker_configuration.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/mskconnect_worker_configuration) | resource | +| [random_id.this](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/id) | resource | | [aws_iam_policy_document.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | ## Inputs diff --git a/main.tf b/main.tf index 800d69a..49d936f 100644 --- a/main.tf +++ b/main.tf @@ -247,13 +247,23 @@ data "aws_iam_policy_document" "this" { # Configuration ################################################################################ +resource "random_id" "this" { + count = var.create && var.create_configuration ? 1 : 0 + + byte_length = 8 +} + resource "aws_msk_configuration" "this" { count = var.create && var.create_configuration ? 1 : 0 - name = coalesce(var.configuration_name, var.name) + name = format("%s-%s", coalesce(var.configuration_name, var.name), random_id.this[0].dec) description = var.configuration_description kafka_versions = [var.kafka_version] server_properties = join("\n", [for k, v in var.configuration_server_properties : format("%s = %s", k, v)]) + + lifecycle { + create_before_destroy = true + } } ################################################################################ diff --git a/versions.tf b/versions.tf index 5cdb3d4..beaaf5f 100644 --- a/versions.tf +++ b/versions.tf @@ -6,5 +6,9 @@ terraform { source = "hashicorp/aws" version = ">= 5.21" } + random = { + source = "hashicorp/random" + version = ">= 3.6" + } } }