Mongey / terraform-provider-kafka

Terraform provider for managing Apache Kafka Topics + ACLs
MIT License
517 stars 129 forks source link

Error: kafka server: Replication-factor is invalid #300

Open Casyfill opened 1 year ago

Casyfill commented 1 year ago

getting that above error with terraform-provider-kafka 0.1.0 on this topic:

...
old_topic = {
     name = "old_topic"
}

new_topic = {
      name = "new_topic"

      config = {
        "cleanup.policy" = "compact"
        "retention.ms"   =  -1
      }

    }
  }
}

resource "kafka_topic" "this" {
  for_each = local.topics
  name               = each.value.name
  replication_factor = 3
  partitions         = 3

}

it fails with

kafka_topic.this["new_topic"]: Creating...

Error: kafka server: Replication-factor is invalid

  with kafka_topic.this["new_topic"],
  on main.tf line 47, in resource "kafka_topic" "this":
  47: resource "kafka_topic" "this" {

time=2022-11-03T17:27:53Z level=error msg=Terraform invocation failed in /home/atlantis/repos/streeteasy/se-aws-staging/673/default/kafka/topics
time=2022-11-03T17:27:53Z level=error msg=1 error occurred:
    * exit status 1

It works fine on other topics without special configs

parnigot commented 1 year ago

How many brokers does your kafka cluster have? replication_factor must me less or equal the number of brokers...

Casyfill commented 1 year ago

it does have 3. I updated the snippet to highlight that I didn't have any problem with other topics, until I added this custom config

jpdias commented 1 week ago

@Casyfill Did you manage to understood what was the issue here? Facing a similar problem on my side.