From 9fb91f90f19775baa2aeeb18e3a834dc6b155715 Mon Sep 17 00:00:00 2001 From: Daniel Weinshenker Date: Tue, 21 Nov 2023 11:06:12 -0800 Subject: [PATCH] Kafka topic + user management fixes - Address minimum min_insync_replicas for topic advanced config - Address deprecated kafka plan - Update documentation --- digitalocean/database/resource_database_cluster_test.go | 2 +- digitalocean/database/resource_database_kafka_topic.go | 2 +- digitalocean/database/resource_database_kafka_topic_test.go | 2 ++ docs/resources/database_kafka_topic.md | 2 +- docs/resources/database_user.md | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/digitalocean/database/resource_database_cluster_test.go b/digitalocean/database/resource_database_cluster_test.go index 1fd80384f..83864a20f 100644 --- a/digitalocean/database/resource_database_cluster_test.go +++ b/digitalocean/database/resource_database_cluster_test.go @@ -843,7 +843,7 @@ resource "digitalocean_database_cluster" "foobar" { name = "%s" engine = "kafka" version = "%s" - size = "db-s-1vcpu-2gb" + size = "db-s-2vcpu-2gb" region = "nyc1" node_count = 3 tags = ["production"] diff --git a/digitalocean/database/resource_database_kafka_topic.go b/digitalocean/database/resource_database_kafka_topic.go index e725ca9b7..f08ad8829 100644 --- a/digitalocean/database/resource_database_kafka_topic.go +++ b/digitalocean/database/resource_database_kafka_topic.go @@ -239,8 +239,8 @@ func ResourceDigitalOceanDatabaseKafkaTopic() *schema.Resource { }, "min_insync_replicas": { Type: schema.TypeInt, + Default: 1, Optional: true, - Computed: true, ValidateFunc: validation.IntAtLeast(1), }, "preallocate": { diff --git a/digitalocean/database/resource_database_kafka_topic_test.go b/digitalocean/database/resource_database_kafka_topic_test.go index b28c060c3..9d4f9c168 100644 --- a/digitalocean/database/resource_database_kafka_topic_test.go +++ b/digitalocean/database/resource_database_kafka_topic_test.go @@ -122,6 +122,8 @@ func TestAccDigitalOceanDatabaseKafkaTopic(t *testing.T) { "digitalocean_database_kafka_topic.foobar", "config.0.min_compaction_lag_ms"), resource.TestCheckResourceAttrSet( "digitalocean_database_kafka_topic.foobar", "config.0.min_insync_replicas"), + resource.TestCheckResourceAttr( + "digitalocean_database_kafka_topic.foobar", "config.0.min_insync_replicas", "1"), resource.TestCheckResourceAttrSet( "digitalocean_database_kafka_topic.foobar", "config.0.retention_bytes"), resource.TestCheckResourceAttrSet( diff --git a/docs/resources/database_kafka_topic.md b/docs/resources/database_kafka_topic.md index 306b78d3c..b39f6fdd1 100644 --- a/docs/resources/database_kafka_topic.md +++ b/docs/resources/database_kafka_topic.md @@ -82,7 +82,7 @@ The following arguments are supported: * `message_timestamp_difference_max_ms` - (Optional) The maximum difference, in ms, between the timestamp specific in a message and when the broker receives the message. * `message_timestamp_type` - (Optional) Specifies which timestamp to use for the message. This may be one of "create_time" or "log_append_time". * `min_cleanable_dirty_ratio` - (Optional) A scale between 0.0 and 1.0 which controls the frequency of the compactor. Larger values mean more frequent compactions. This is often paired with `max_compaction_lag_ms` to control the compactor frequency. -* `min_insync_replicas` - (Optional) The number of replicas that must acknowledge a write before it is considered successful. -1 is a special setting to indicate that all nodes must ack a message before a write is considered successful. +* `min_insync_replicas` - (Optional) The number of replicas that must acknowledge a write before it is considered successful. -1 is a special setting to indicate that all nodes must ack a message before a write is considered successful. Default is 1, indicating at least 1 replica must acknowledge a write to be considered successful. * `preallocate` - (Optional) Determines whether to preallocate a file on disk when creating a new log segment within a topic. * `retention_bytes` - (Optional) The maximum size, in bytes, of a topic before messages are deleted. -1 is a special setting indicating that this setting has no limit. * `retention_ms` - (Optional) The maximum time, in ms, that a topic log file is retained before deleting it. -1 is a special setting indicating that this setting has no limit. diff --git a/docs/resources/database_user.md b/docs/resources/database_user.md index 0e6a3998d..e597bc83a 100644 --- a/docs/resources/database_user.md +++ b/docs/resources/database_user.md @@ -103,7 +103,7 @@ The `settings` block is documented below. An individual ACL includes the following: -* `topic` - (Required) A regex for matching the topic(s) that this ACL should apply to. +* `topic` - (Required) A regex for matching the topic(s) that this ACL should apply to. The regex can assume one of 3 patterns: "*", "*", or "". "*" is a special value indicating a wildcard that matches on all topics. "*" defines a regex that matches all topics with the prefix. "" performs an exact match on a topic name and only applies to that topic. * `permission` - (Required) The permission level applied to the ACL. This includes "admin", "consume", "produce", and "produceconsume". "admin" allows for producing and consuming as well as add/delete/update permission for topics. "consume" allows only for reading topic messages. "produce" allows only for writing topic messages. "produceconsume" allows for both reading and writing topic messages. ## Attributes Reference