A Terraform plugin for managing Confluent Cloud Kafka Clusters.
Download and extract the latest release to
your terraform plugin directory (typically ~/.terraform.d/plugins/
)
Configure the provider directly, or set the ENV variables CONFLUENT_CLOUD_USERNAME
&CONFLUENT_CLOUD_PASSWORD
provider "confluentcloud" {}
resource "confluentcloud_environment" "environment" {
name = "default"
}
resource "confluentcloud_kafka_cluster" "test" {
name = "provider-test"
service_provider = "aws"
region = "eu-west-1"
availability = "LOW"
environment_id = confluentcloud_environment.environment.id
}
resource "confluentcloud_api_key" "provider_test" {
cluster_id = confluentcloud_kafka_cluster.test.id
environment_id = confluentcloud_environment.environment.id
}
resource "confluentcloud_service_account" "test" {
name = "test"
description = "service account test"
}
locals {
bootstrap_servers = [replace(confluentcloud_kafka_cluster.test.bootstrap_servers, "SASL_SSL://", "")]
}
provider "kafka" {
bootstrap_servers = local.bootstrap_servers
tls_enabled = true
sasl_username = confluentcloud_api_key.provider_test.key
sasl_password = confluentcloud_api_key.provider_test.secret
sasl_mechanism = "plain"
}
resource "kafka_topic" "syslog" {
name = "syslog2"
replication_factor = 3
partitions = 1
}
output "kafka_url" {
value = local.bootstrap_servers
}
output "key" {
value = confluentcloud_api_key.provider_test.key
sensitive = true
}
output "secret" {
value = confluentcloud_api_key.provider_test.secret
sensitive = true
}