confluent_kafka_cluster_config
provides a Kafka cluster config resource that enables updating configs on a Dedicated Kafka cluster on Confluent Cloud.
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
}
resource "confluent_kafka_cluster_config" "orders" {
kafka_cluster {
id = confluent_kafka_cluster.dedicated.id
}
rest_endpoint = confluent_kafka_cluster.dedicated.rest_endpoint
config = {
"auto.create.topics.enable" = "true"
"log.retention.ms" = "604800123"
}
credentials {
key = confluent_api_key.app-manager-kafka-api-key.id
secret = confluent_api_key.app-manager-kafka-api-key.secret
}
}
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
}
resource "confluent_kafka_cluster_config" "orders" {
config = {
"auto.create.topics.enable" = "true"
"log.retention.ms" = "604800123"
}
}
The following arguments are supported:
kafka_cluster
- (Optional Configuration Block) supports the following:
id
- (Required String) The ID of the Dedicated Kafka cluster, for example, lkc-abc123
.rest_endpoint
- (Optional String) The REST endpoint of the Dedicated 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, Sensitive) The Kafka API Secret.config
- (Optional Map) The custom cluster settings to set:
name
- (Required String) The setting name, for example, auto.create.topics.enable
.value
- (Required String) The setting value, for example, true
.In addition to the preceding arguments, the following attributes are exported:
id
- (Required String) The ID of the Kafka cluster config, in the format <Kafka cluster ID>
, for example, lkc-abc123
.You can import a Kafka cluster config by using the Kafka cluster ID, for example:
# Option #1: Manage multiple Kafka clusters in the same Terraform workspace
$ export IMPORT_KAFKA_API_KEY="<kafka_api_key>"
$ export IMPORT_KAFKA_API_SECRET="<kafka_api_secret>"
$ export IMPORT_KAFKA_REST_ENDPOINT="<kafka_rest_endpoint>"
$ terraform import confluent_kafka_cluster_config.test lkc-abc123
# Option #2: Manage a single Kafka cluster in the same Terraform workspace
$ terraform import confluent_kafka_cluster_config.test lkc-abc123