From fddac80f38409794a1e6c334c16b1f6086b4ee8e Mon Sep 17 00:00:00 2001 From: the-middle Date: Tue, 3 Sep 2024 19:50:28 +0500 Subject: [PATCH] Fix same name error when recreating aws_msk_configuration --- main.tf | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index 244489b..f0b3a7e 100644 --- a/main.tf +++ b/main.tf @@ -250,6 +250,11 @@ data "aws_iam_policy_document" "this" { resource "random_id" "this" { count = var.create && var.create_configuration ? 1 : 0 + keepers = { + kafka_version = var.kafka_version + server_properties = join("\n", [for k, v in var.configuration_server_properties : format("%s = %s", k, v)]) + } + byte_length = 8 } @@ -258,8 +263,8 @@ resource "aws_msk_configuration" "this" { 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)]) + kafka_versions = [random_id.this[0].keepers.kafka_version] + server_properties = random_id.this[0].keepers.server_properties lifecycle { create_before_destroy = true