Skip to content

ashwini-hopin/terraform-provider-confluentcloud

 
 

Repository files navigation

terraform-plugin-confluentcloud

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_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
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 73.8%
  • Makefile 13.2%
  • Shell 13.0%