Skip to content

Latest commit

 

History

History
58 lines (43 loc) · 1.61 KB

File metadata and controls

58 lines (43 loc) · 1.61 KB

terraform-plugin-confluent-cloud

A Terraform plugin for managing Confluent Cloud Kafka Clusters.

Installation

Download and extract the latest release to your terraform plugin directory (typically ~/.terraform.d/plugins/)

Example

Configure the provider directly, or set the ENV variables CONFLUENT_CLOUD_USERNAME &CONFLUENT_CLOUD_PASSWORD

provider "confluentcloud" {}

resource "confluentcloud_kafka_cluster" "test" {
  name             = "provider-test"
  service_provider = "aws"
  region           = "eu-west-1"
  availability     = "single-zone"
}

resource "confluentcloud_api_key" "provider_test" {
  cluster_id = confluentcloud_kafka_cluster.test.id
}

provider "kafka" {
  bootstrap_servers = [replace(confluentcloud_kafka_cluster.test.bootstrap_servers, "SASL_SSL://", "")]

  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 = replace(confluentcloud_kafka_cluster.test.bootstrap_servers, "SASL_SSL://", "")
}

output "key" {
  value = confluentcloud_api_key.provider_test.key
}

output "secret" {
  value = confluentcloud_api_key.provider_test.secret
}