digitalocean_database_kafka_topic

Provides a DigitalOcean Kafka topic for Kafka clusters.

Example Usage

Create a new Kafka topic

resource "digitalocean_database_kafka_topic" "topic-01" {
  cluster_id         = digitalocean_database_cluster.kafka-example.id
  name               = "topic-01"
  partition_count    = 3
  replication_factor = 2
  config {
    cleanup_policy                      = "compact"
    compression_type                    = "uncompressed"
    delete_retention_ms                 = 14000
    file_delete_delay_ms                = 170000
    flush_messages                      = 92233
    flush_ms                            = 92233720368
    index_interval_bytes                = 40962
    max_compaction_lag_ms               = 9223372036854775807
    max_message_bytes                   = 1048588
    message_down_conversion_enable      = true
    message_format_version              = "3.0-IV1"
    message_timestamp_difference_max_ms = 9223372036854775807
    message_timestamp_type              = "log_append_time"
    min_cleanable_dirty_ratio           = 0.5
    min_compaction_lag_ms               = 20000
    min_insync_replicas                 = 2
    preallocate                         = false
    retention_bytes                     = -1
    retention_ms                        = -1
    segment_bytes                       = 209715200
    segment_index_bytes                 = 10485760
    segment_jitter_ms                   = 0
    segment_ms                          = 604800000
  }
}

resource "digitalocean_database_cluster" "kafka-example" {
  name       = "example-kafka-cluster"
  engine     = "kafka"
  version    = "3.5"
  size       = "db-s-2vcpu-2gb"
  region     = "nyc1"
  node_count = 3
  tags       = ["production"]
}

Argument Reference

The following arguments are supported:

config supports the following:

Attributes Reference

In addition to the above arguments, the following attributes are exported:

Import

Topics can be imported using the id of the source cluster and the name of the topic joined with a comma. For example:

terraform import digitalocean_database_kafka_topic.topic-01 245bcfd0-7f31-4ce6-a2bc-475a116cca97,topic-01