# 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"

}
# 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"

}

Schema

Required

cluster_id
string
required
Unique cluster ID related to the connector
name
string
required
Name of the connector
properties
map(string)
required
Properties that the connector will have. Please check the documentation of the related connector.

Optional

running_state
string
Running state of the connector

Read-Only

cluster_id
string
Unique connector ID for created connector
creation_time
number
Creation of the connector
id
string
The ID of this resource.