> ## Documentation Index
> Fetch the complete documentation index at: https://upstash-vector.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# upstash_kafka_connector

> Create and manage Kafka Connectors.

<RequestExample>
  ```hcl example.tf
  # Not necessary if the topic belongs to an already created cluster.
  resource "upstash_kafka_cluster" "exampleKafkaCluster" {
    cluster_name = "Terraform_Upstash_Cluster"
    region       = "eu-west-1"
    multizone    = false
  }

  resource "upstash_kafka_topic" "exampleKafkaTopic" {
    topic_name       = "TerraformTopic"
    partitions       = 1
    retention_time   = 625135
    retention_size   = 725124
    max_message_size = 829213
    cleanup_policy   = "delete"

    # Here, you can use the newly created kafka_cluster resource (above) named exampleKafkaCluster.
    # And use its ID so that the topic binds to it.

    # Alternatively, provide the ID of an already created cluster.
    cluster_id = resource.upstash_kafka_cluster.exampleKafkaCluster.cluster_id

  }

  resource "upstash_kafka_connector" "exampleKafkaConnector" {
    name = var.connector_name
    cluster_id = upstash_kafka_cluster.exampleKafkaCluster.cluster_id
    properties = {
      "collection": "user123",
      "connection.uri": "mongodb+srv://test:test@cluster0.fohyg7p.mongodb.net/?retryWrites=true&w=majority",
      "connector.class": "com.mongodb.kafka.connect.MongoSourceConnector",
      "database": "myshinynewdb2",
      "topics": "${upstash_kafka_topic.exampleKafkaTopic.topic_name}"
    }
    # OPTIONAL: change between restart-running-paused
    # running_state = "running"

  }
  ```
</RequestExample>

## Schema

### Required

<ParamField query="cluster_id" type="string" required>
  Unique cluster ID related to the connector
</ParamField>

<ParamField query="name" type="string" required>
  Name of the connector
</ParamField>

<ParamField query="properties" type="map(string)" required>
  Properties that the connector will have. Please check the documentation of the
  related connector.
</ParamField>

### Optional

<ParamField query="running_state" type="string">
  Running state of the connector
</ParamField>

### Read-Only

<ResponseField name="cluster_id" type="string">
  Unique connector ID for created connector
</ResponseField>

<ResponseField name="creation_time" type="number">
  Creation of the connector
</ResponseField>

<ResponseField name="id" type="string">
  The ID of this resource.
</ResponseField>
