confluent_kafka_topic
describes a Kafka Topic data source.
provider "confluent" {
cloud_api_key = var.confluent_cloud_api_key # optionally use CONFLUENT_CLOUD_API_KEY env var
cloud_api_secret = var.confluent_cloud_api_secret # optionally use CONFLUENT_CLOUD_API_SECRET env var
}
data "confluent_kafka_topic" "orders" {
kafka_cluster {
id = confluent_kafka_cluster.basic-cluster.id
}
topic_name = "orders"
rest_endpoint = confluent_kafka_cluster.basic-cluster.rest_endpoint
credentials {
key = "<Kafka API Key for confluent_kafka_cluster.basic-cluster>"
secret = "<Kafka API Secret for confluent_kafka_cluster.basic-cluster>"
}
}
output "config" {
value = data.confluent_kafka_topic.orders.config
}
provider "confluent" {
kafka_id = var.kafka_id # optionally use KAFKA_ID env var
kafka_rest_endpoint = var.kafka_rest_endpoint # optionally use KAFKA_REST_ENDPOINT env var
kafka_api_key = var.kafka_api_key # optionally use KAFKA_API_KEY env var
kafka_api_secret = var.kafka_api_secret # optionally use KAFKA_API_SECRET env var
}
data "confluent_kafka_topic" "orders" {
topic_name = "orders"
}
output "config" {
value = data.confluent_kafka_topic.orders.config
}
The following arguments are supported:
kafka_cluster
- (Optional Configuration Block) supports the following:
id
- (Required String) The ID of the Kafka cluster, for example, lkc-abc123
.topic_name
- (Required String) The name of the topic, for example, orders-1
. The topic name can be up to 255 characters in length and can contain only alphanumeric characters, hyphens, and underscores.rest_endpoint
- (Optional String) The REST endpoint of the Kafka cluster, for example, https://pkc-00000.us-central1.gcp.confluent.cloud:443
).credentials
(Optional Configuration Block) supports the following:
key
- (Required String) The Kafka API Key.secret
- (Required String) The Kafka API Secret.In addition to the preceding arguments, the following attributes are exported:
id
- (Required String) The ID of the Kafka topic, in the format <Kafka cluster ID>/<Kafka Topic name>
, for example, lkc-abc123/orders-1
.partitions_count
- (Required Number) The number of partitions to create in the topic. Defaults to 6
.config
- (Optional Map) The custom topic settings:
name
- (Required String) The setting name, for example, cleanup.policy
.value
- (Required String) The setting value, for example, compact
.