terraform-contour-mirror/modules/kafka-topics-incluster/outputs.tf

31 lines
1.3 KiB
HCL

output "topic_names" {
description = "Kafka topics managed by this service manifest state."
value = keys(kafka_topic.this)
}
output "user_names" {
description = "Kafka users managed by this service manifest state."
value = [for u in kafka_user_scram_credential.this : u.username]
}
# Same shape and key format (clusterRef:user) as modules/kafka-topics-yc so the
# shared k8s-secret module consumes both backends identically.
output "kafka_outputs_map" {
description = "Map for k8s-secret module. Key format: clusterRef:user."
value = {
for key, item in local.user_clusters : key => {
host = try(item.cluster.host, "")
hostname = try(item.cluster.bootstrap_servers, "")
port = tostring(try(item.cluster.port, 9092))
username = item.user
password = try(random_password.kafka_user[key].result, "")
sasl_mechanism = try(item.cluster.sasl_mechanism, "SCRAM-SHA-512")
security_protocol = try(item.cluster.security_protocol, "SASL_PLAINTEXT")
bootstrap_server = try(item.cluster.bootstrap_servers, "")
bootstrap_servers = try(item.cluster.bootstrap_servers, "")
bootstrap_servers_json = try(jsonencode([item.cluster.bootstrap_servers]), "[]")
}
}
sensitive = true
}