Mongey/terraform-provider-kafka

Kafka Broker Issue

th3cod3r opened this issue · 2 comments

Hey @Mongey,

I was getting error with my tf file that Error: kafka: client has run out of available brokers to talk to: EOF

Here is tf file

terraform {
required_providers {
kafka = {
source = "Mongey/kafka"
version = "0.7.1"
}
}
}

provider "kafka" {
bootstrap_servers = ["192.168.24.15:9094"]
}

resource "kafka_topic" "logs" {
name = "a"
replication_factor = 1
partitions = 1
}

resource "kafka_quota" "quota" {
entity_name = "a"
entity_type = "user"
}

resource "kafka_acl" "test" {
resource_name = "a"
resource_type = "Topic"
acl_principal = "User:jamesontest2"
acl_host = "192.168.24.15"
acl_operation = "All"
acl_permission_type = "Allow"
}

Requirement:

The kafka is a shared kafka and I just only want to connect in it with a specific tenant id as i have to separate the kafka database with the tenant id (When a another server will connect then i have some producer that will auto-insert into it with the particular tenant id which i defined).
And have to apply some acl for security as well.

Same issue against an AWS MSK setup. Network access is set up, and getting the same error even with assuming a role that has full access to the AWS account. The error message is not very useful unfortunately

I had the same issue. This has more or less been addressed in the readme. In my case, I had to instantiate the provider as so:

data "aws_msk_cluster" "main" {
  cluster_name = "MyClusterName"
}

data "aws_arn" "msk_cluster" {
  arn = data.aws_msk_cluster.main.arn
}

provider "kafka" {
  bootstrap_servers = split(",", data.aws_msk_cluster.main.bootstrap_brokers_sasl_iam)
  tls_enabled       = true
  sasl_mechanism    = "aws-iam"
  sasl_aws_region   = data.aws_arn.msk_cluster.region
}

I then assumed the required AWS role before running terraform apply.